First of all, congrats on the io'17 ExoPlayer presentation!
I would like to implement a "hold picture" (or freeze) functionality in the app, where a player would hold a last frame from previous stream, when switching to another stream (zapping through channels).
Since ExoPlayer is really quick on zapping through streams, what happens at the moment, is that you see the black background with a spinner for a short moment of time before the player switches to another stream (by releasing the previous ExoPlayer instance). So when you just quickly zap through channels, you have this annoying black screen blinking. It would be much better if you could hold the last frame of the previous stream visible, before the next stream is ready to be played.
I don't think concatenating is a good solution in this case, since you don't really know, which stream is going to be selected next (it's selected from the list). And you also mentioned in the io'17 presentation, that using two ExoPlayer instances is not a very good idea either.
Or maybe you could offer a way to customize or at least show where to dive in the existing version of the ExoPlayer, thanks!
Quickly zap through different streams in a sequence.
2.4.0
Nexus Player
Sony Android TV
The surface should still be holding the last frame just fine, so it's likely the black you see is actually another view being made temporarily visible on top. My guess is you're using SimpleExoPlayerView. It has a "shutter view" that does exactly this. Marking this as an enhancement, in which we'll provide an option on SimpleExoPlayerView to disable the shutter becoming visible if something has been rendered into the surface.
Shouldn't take long to add support for this, but in the meantime you could edit SimpleExoPlayerView yourself locally, or override the player view's layout xml to be the same as the default one but without the shutter.
Thanks, it works exactly as it should. Looking forward to the enhancement in the future.
Hello, is this still in the works?
I used simpleExoPlayerView.setShutterBackgroundColor(Color.TRANSPARENT); to solve this.
Quick question for you, do you release the player everytime you plan a new media by zapping? Or you just set a new mediaSource then play it?
We've added PlayerView.setKeepContentOnPlayerReset for this.
@ojw28, just out of interest: if you switch the app to another stream/video and the next stream is being buffered for a long time, the previous picture will stay frozen during this buffering time. Do you think it would be handy to add some kind of timeout, after which you could reset the previous picture to black?
Can you be more specific about how PlayerView.setKeepContentOnPlayerReset is supposed to be used? How can I call it after creating a SimpleExoPlayer? It seems I can't call it directly and there also isn't a getPlayerView function.
I'm using a SurfaceView, is the feature still available to me?
Hi @ChristianKleineidam, your player view is part of your view hierarchy. To get it you can look at the demo app:
playerView = findViewById(R.id.player_view);
and then you can call it there.
I'm using a SurfaceView, is the feature still available to me?
Yes, it should be independent of the surface type, I think.
If I call playerView = findViewById(R.id.player_view); that doesn't find anything and given that the only view I have defined in my xml files is my SurfaceView it also doesn't seem surprising that it doesn't find anything.
Yet the shutter does still seem to be displayed over my SurfaceView.
setKeepContentOnPlayerReset is a method defined on PlayerView If you're using SurfaceView directly then you're presumably implementing your own playback controls etc. You will also not be getting our shutter, since that's part of PlayerView, and so this issue is irrelevant to your use case.
If you're using SurfaceView and DRM protected content that requires a secure output path, then it's likely the SurfaceView is being cleared by the underlying platform, which is unrelated to the shutter. See https://github.com/google/ExoPlayer/issues/3741#issuecomment-365367065 for more details.
In a related note, is it possible to keep the last frame after an orientation/configuration change? I've been trying to accomplish this but not sure it is possible since a the Surface/Texture view is recreated.
Most helpful comment
The surface should still be holding the last frame just fine, so it's likely the black you see is actually another view being made temporarily visible on top. My guess is you're using
SimpleExoPlayerView. It has a "shutter view" that does exactly this. Marking this as an enhancement, in which we'll provide an option onSimpleExoPlayerViewto disable the shutter becoming visible if something has been rendered into the surface.Shouldn't take long to add support for this, but in the meantime you could edit
SimpleExoPlayerViewyourself locally, or override the player view's layout xml to be the same as the default one but without the shutter.