fluttercommunity / chewie

The video player for Flutter with a heart of gold
MIT License
1.94k stars 1.01k forks source link

Landscape fullscreen rotation #394

Closed ghost closed 4 years ago

ghost commented 4 years ago

Currently when you go fullscreen on a landscape video, the direction is locked. Meaning you can't change the video direction by rotating your phone 180 degree.

I think regular users do not expect that to be the case.

Youtube, Netflix and Chrome's HTML5 fullscreen video all do this by default. Regardless of the user's system "auto-rotate" settings:

  1. On any of the above app, enter fullscreen.
  2. Rotate your phone 180 degree. The video direction changes.
  3. Rotate your phone back 180 degree. The video direction changes.

I propose:

  1. Use sensor-based rotation by default for landscape fullscreen mode
  2. Still allow developers to lock-in in one direction (Like current behavior)

I'm only talking about Android. I don't know how it works on iOS, so inputs are welcome.

seokhyeonML commented 4 years ago

in iOS, landscape video do not goes to full screen..

Ahmadre commented 4 years ago

Guys this is already fixed and merged. Please update your chewie version. On v. 0.10.0 (we're now on 0.10.4) exactly this was published. I'll demonstrate it you

Ahmadre commented 4 years ago
  1. On default chewie calculates regarding the video aspect ratio, wether to go on landscape or portrait (landscape videos go to landscape and portrait videos to portrait -> exact same behavior like Youtube)
  2. You can control all kind of DeviceOrientation while you're in fullscreen or not. Use these:
deviceOrientationsAfterFullScreen: [
        DeviceOrientation.portraitUp,
        DeviceOrientation.landscapeRight,
        DeviceOrientation.landscapeLeft,
],
deviceOrientationsOnEnterFullScreen: [
        DeviceOrientation.portraitUp,
],

Auto-Rotate: Example behavior if parameters above are not set:

autoRotate

Custom set DeviceOrientations (fixed to Portrait only):

fixedPortrait

ghost commented 4 years ago

Yes, that's how it should be. I guess on iOS it just works. But on Android it's not. I'll attach GIF in a second.

Ahmadre commented 4 years ago

For further informations please see this PR: https://github.com/brianegan/chewie/pull/289

I'll update the Readme file and maybe also add an API-Documentation explicitly (because not all parameters are likely known).

I'll close this issue because it's already fixed and developers can decide how their player is behaving (see PR and examples above). Download and test it with the latest chewie. Don't hesitate to reopen if you think It's not

Ahmadre commented 4 years ago

Yes, that's how it should be. I guess on iOS it just works. But on Android it's not. I'll attach GIF in a second.

It'n not an android thing. Wait, I'll demonstrate again...

Ahmadre commented 4 years ago

Ok, I can't upload videos above 100Mb, but here my explanation: On Android and iOS you got the ability to lock or unlock device rotations. But as discussed here: https://github.com/brianegan/chewie/pull/289 we already decided to track the video aspect ratio and not the system settings for rotation. BUT on every device you can change this behavior yourself (without chewie!) by setting:

    this.systemOverlaysAfterFullScreen = SystemUiOverlay.values,
    this.systemOverlaysEnterFullScreen = SystemUiOverlay.values,
    this.deviceOrientationsAfterFullScreen = DeviceOrientation.values,
    this.deviceOrientationsOnEnterFullScreen = DeviceOrientation.values,

And that's why we gave developers these parameters to control this behavior yourself :)

ghost commented 4 years ago

On master branch, latest version, with default settings: https://i.imgur.com/pFkwbSY.mp4

Youtube comparison: https://i.imgur.com/vbax1Ct.mp4