Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExoPlayer switching media source without black screen

I'm using exoplayer in my project, when switching mediasource i just use

player.stop();
player.prepare(mediaSource);

This causes approx. 0.5 seconds black screen until it switches video.

Is there a way to tell exoplayer to retain last frame from previous video (instead of 0.5 sec black screen) until new video is started?

like image 930
Mister M Avatar asked Dec 05 '22 11:12

Mister M


2 Answers

simpleExoPlayerView.setShutterBackgroundColor(Color.TRANSPARENT);
like image 151
Mister M Avatar answered Feb 04 '23 22:02

Mister M


Exoplayer's developers have provided solution to this issue here.

Simply add this line using your SimplePlayerView instance

playerView.setKeepContentOnPlayerReset(true);

Alternatively, you can also do this via your layout.xml file,

app:keep_content_on_player_reset="true"
like image 39
Anubhav Malik Avatar answered Feb 05 '23 00:02

Anubhav Malik