Android video playback audio works but no video
See original GitHub issueHello,
Revisiting this extension after some inactivity and am currently trying to get mp4 video working on android. I have created a Screen that should be playing video. The problem is that the screen remains blank but the audio plays in the background.
Can you provide any guidance? Ideally I want to be able to render video on android onto a specific texture (in an Actor) so that I can put it in a stage and have other Actors rendered on top of the video.
Below is an excerpt of my Screen class: `public VideoPlayer videoPlayer;
boolean videoLoaded = false;
@Override
public void show() {
videoPlayer = VideoPlayerCreator.createVideoPlayer();
videoPlayer.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
videoPlayer.setOnVideoSizeListener(new VideoPlayer.VideoSizeListener() {
@Override
public void onVideoSize(float v, float v2) {
videoLoaded = true;
}
});
try {
videoPlayer.play(Gdx.files.absolute("/path/to/file.mp4"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Gdx.gl.glEnable(GL20.GL_CULL_FACE);
Gdx.gl.glCullFace(GL20.GL_BACK);
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
if(videoLoaded) {
if (!videoPlayer.render()) { // As soon as the video is finished, we start the file again using the same player.
try {
videoLoaded = false;
videoPlayer.play(Gdx.files.absolute("/path/to/file.mp4"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
}`
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
8 Ways to Fix Video Sound Not Working on Android
Fix 1: The Volume Settings · Fix 2: Restarting the Device · Fix 3: Wondershare Repairit - Repair No Sound Videos Online/Offline ·...
Read more >How to Fix 'No sound on Android video' Error
Outdated version of your phone?s operating system (OS ) might result in no sound when playing videos on Android. Update the OS to...
Read more >7 Methods to Fix Video Not Playing on Android Phone
All you need to do is to close all the running applications on your phone and restart or reboot it. Once your phone...
Read more >Fix No Sound on Videos When Playing on An Android Phone!
01 Re-Check Basic Settings · First and foremost, hop onto the settings section on your phone, and ensure everything is in place. ·...
Read more >android video, hear sound but no video - Stack Overflow
public void onCreate ; (Bundle savedInstanceState) · super · this ; SurfaceView v = ; SurfaceHolder holder = ; // Set the transparency...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For android video play using libgdx You need to use below in screen class
and you can play video from activity
Could you try if the issue persists with the newest snapshot?