chewie icon indicating copy to clipboard operation
chewie copied to clipboard

On iOS, an error message is displayed when entering/exiting fullscreen

Open Ne0xygene opened this issue 2 years ago • 3 comments

What I did

  1. When entering fullscreen, an error is display in the console:
Failed to change device orientation: Error Domain=UISceneErrorDomain Code=101 "None of the requested orientations are 
supported by the view controller. Requested: landscapeLeft, landscapeRight; Supported: portrait" UserInfo=
{NSLocalizedDescription=None of the requested orientations are supported by the view controller. Requested: landscapeLeft, 
landscapeRight; Supported: portrait}
  1. When exiting fullscreen, an error is also display in the console:
Failed to change device orientation: Error Domain=UISceneErrorDomain Code=101 "None of the requested orientations are 
supported by the view controller. Requested: portrait; Supported: landscapeLeft, landscapeRight" UserInfo=
{NSLocalizedDescription=None of the requested orientations are supported by the view controller. Requested: portrait; 
Supported: landscapeLeft, landscapeRight}

Tested on: iOS Simulator Iphone 14 Pro Max iOS 16.4

Note: The error seems to only appears in iOS devices.

Here is my chewieController setup :

chewieController = ChewieController(
  aspectRatio: 16 / 9,
  autoInitialize: true,
  fullScreenByDefault: false,
  deviceOrientationsAfterFullScreen: [
    DeviceOrientation.portraitUp,
  ],
  videoPlayerController: _controller,
  autoPlay: true,
  looping: false,
);

In case I have setup the available orientations in Info.plist:

<key>UISupportedInterfaceOrientations</key>
<array>
  <string>UIInterfaceOrientationLandscapeLeft</string>
  <string>UIInterfaceOrientationLandscapeRight</string>
  <string>UIInterfaceOrientationPortrait</string>
</array>

And my main.dart forced a specific orientation:

await SystemChrome.setPreferredOrientations([
  DeviceOrientation.portraitUp,
]);

Ne0xygene avatar Jul 04 '23 14:07 Ne0xygene

Have you tried setting all orientations before going to fullscreen and back to default when escaping full screen?

hkarmoush avatar Jul 08 '23 13:07 hkarmoush

Have you tried setting all orientations before going to fullscreen and back to default when escaping full screen?

I tried to use deviceOrientationOnFullScreen with the following setup :

deviceOrientationsOnEnterFullScreen: [
  DeviceOrientation.landscapeLeft,
  DeviceOrientation.landscapeRight,
  DeviceOrientation.portraitUp, // If not added, the error persist
],

There is no longer an error but it does not put the video on landscape mode automatically on fullscreen.

I would like to avoid setting the orientations through SystemChrome.setPreferredOrientations() as I want my app to be strictly used in portrait mode (unless it is a video).

Ne0xygene avatar Jul 10 '23 12:07 Ne0xygene

Any update? I have same issues.

trinhvuduc avatar Jul 21 '23 10:07 trinhvuduc