Skip to content

Android single repeat mode has black flash

Hi I am using libvlc 3.1.2 and the same problem exists in the latest vlc-android-app as well.
The problem:
for single loop mode, in the case MediaPlayer.Event.EndReached of MediaPlayer.EventListener, one may write:

if(singleLoop){  
    mMediaPlayer.stop();  
    mMediaPlayer.play();  
}  

however mMediaPlayer.stop() will turn the attached videoview into BLACK, which will hurt users' eyes if they are staring at the screen.
I tried putting before mMediaPlayer.stop() those lines:

 mMediaPlayer.getVLCVout().detachViews();   
 mMediaPlayer.getVLCVout().setVideoView(new SurfaceView(getApplicationContext()));   
 mMediaPlayer.getVLCVout().attachViews();   

But they didn't work, the videoview still became black because of mMediaPlayer.stop().

For comparison, the mxplayer doesn's have this black flash in the single repeat mode, so the users can repeat watching the same short video 100 times without hurting their eyes...

Edited by knziha