ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Allow app to update StyledPlayerView fullscreen state 'out of band'

Open samfundev opened this issue 3 years ago • 3 comments

Use case description

When using StyledPlayerControlView's fullscreen button, it should be able to follow the orientation of the device. If the user rotates into landscape, the button should exit fullscreen. Not try to enter fullscreen again.

Proposed solution

StyledPlayerControlView should watch for orientation changes and trigger fullscreen updates if the device enters landscape.

Alternatives considered

Not using StyledPlayerControlView's fullscreen button. Fullscreen cannot be manually set, so there is no way to tell it that the orientation has changed.

samfundev avatar Jun 29 '22 16:06 samfundev

I could be misunderstanding, but there seems to be an implicit assumption here that when an app rotates into landscape the video will always be made fullscreen. I don't think that's a reasonable assumption in the general case.

I understand that some apps will have this behaviour. More generally, it seems reasonable that an app will want to enter fullscreen mode without the user hitting the UI fullscreen button (whether that's due to rotation, or another signal), and in that case needs a way to indicate to the UI to update the 'mode' of the button. I think this is also what you're pointing out is missing here (emphasis mine):

Fullscreen cannot be manually set, so there is no way to tell it that the orientation has changed.

So if we changed this enhancement into allowing apps to indicate the fullscreen state has changed (without the UI fullscreen button being pressed), would that resolve your concern?

icbaker avatar Aug 19 '22 09:08 icbaker

there seems to be an implicit assumption here that when an app rotates into landscape the video will always be made fullscreen. I don't think that's a reasonable assumption in the general case.

I agree that the video will not always be fullscreen, but that I'm assuming this is a common use case. So this would be a feature developers would opt into.

So if we changed this enhancement into allowing apps to indicate the fullscreen state has changed (without the UI fullscreen button being pressed), would that resolve your concern?

Yes, that would.

samfundev avatar Aug 19 '22 21:08 samfundev

Thanks for confirming my proposal would work. I'm afraid I don't know when we'll implement this, but we would accept a high quality PR for this.

icbaker avatar Sep 08 '22 16:09 icbaker

Stumbled upon this issue, but also using expolayer in a jetpack compose app, and it seems that due the nature of compose and how views are torn down and recomposed if state changes, the act of triggering a non-fullscreen to fullscreen with the fullscreen button in PlayerView causes the internal state of the button to be lost.

At least that's what we are seeing in our app, and it has nothing todo with orientation change.

We just simply hit the button, which causes the rendering to change, and then the player no longer displays as full screen.

Are there any examples of a working fullscreen button in jetpack compose with expo player? Maybe our approach at making the player full screen is just wrong?

Thanks.

raytiley avatar Dec 05 '22 03:12 raytiley