Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide option to keep the last frame of a previous source visible when switching sources #2843

Closed
needz opened this issue May 18, 2017 · 12 comments
Assignees

Comments

@needz
Copy link

needz commented May 18, 2017

First of all, congrats on the io'17 ExoPlayer presentation!

Issue description

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!

Reproduction steps

Quickly zap through different streams in a sequence.

Version of ExoPlayer being used

2.4.0

Device(s) and version(s) of Android being used

Nexus Player
Sony Android TV

@needz needz changed the title Freeze last frame before switching to another stream (channel) Freeze last frame before switching to another live stream May 18, 2017
@ojw28 ojw28 changed the title Freeze last frame before switching to another live stream Provide option to keep the last frame of a previous source visible when switching sources May 22, 2017
@ojw28
Copy link
Contributor

ojw28 commented May 22, 2017

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.

@needz
Copy link
Author

needz commented Jun 2, 2017

Thanks, it works exactly as it should. Looking forward to the enhancement in the future.

@emilieroberts
Copy link

Hello, is this still in the works?

@amanenk
Copy link

amanenk commented Feb 5, 2018

I used simpleExoPlayerView.setShutterBackgroundColor(Color.TRANSPARENT); to solve this.

@jboisjo
Copy link

jboisjo commented Mar 8, 2018

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?

ojw28 added a commit that referenced this issue May 12, 2018
@ojw28 ojw28 closed this as completed May 12, 2018
@ojw28
Copy link
Contributor

ojw28 commented May 12, 2018

We've added PlayerView.setKeepContentOnPlayerReset for this.

@needz
Copy link
Author

needz commented May 12, 2018

@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?

@ChristianKleineidam
Copy link

ChristianKleineidam commented May 25, 2018

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?

@AquilesCanta
Copy link
Contributor

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.

@ChristianKleineidam
Copy link

ChristianKleineidam commented May 27, 2018

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.

@ojw28
Copy link
Contributor

ojw28 commented May 29, 2018

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 #3741 (comment) for more details.

@robl2e
Copy link

robl2e commented Jul 9, 2018

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.

@google google locked and limited conversation to collaborators Sep 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants