Open cbenhagen opened 6 years ago
Thanks for the feedback, I'll look at how each platform handles those rotations and see how I can improve it. Also, please feel free to contribute if this is functionality ya need more immediately! Might be a week or more before I can look at this.
Thank you for the quick response. I already tried to dig into your code (and the video_player plugin) to see how to possibly add that functionality myself but I doubt I am able to do this right now as I am very new to dart/flutter and have never touched java/swift code. But hey maybe with some guidance I might come up with a PR. Let me know if you have an idea how it could be done and I give it a try.
My initial thought was to use an OrientationBuilder and tell the VideoPlayerController or Chewie to go fullscreen. But that does not seem to be possible.
What do you mean by looking at how each platform handles those rotations? Technically or from a user experience standpoint? The Youtube and Vimeo apps on Android behave like I suggested and it feels very natural. Not sure about iOS but I can check that. Bet this feels natural for iOS users as well but it could also be configurable.
Yah, OrientationBuilder might not quite work for this one. We might need to use something a bit different, such as a WidgetsBindingObserver + didChangeMetrics
function, e.g. https://docs.flutter.io/flutter/widgets/WidgetsBindingObserver/didChangeMetrics.html
And yep, by looking at the platforms, I mean studying how iOS handles rotations with video to make sure the behavior "feels natural" for iOS users as well.
@brianegan any news on this?
Heya @cbenhagen -- I gave it a shot but my initial attempt didn't quite work out the way I was hoping. I'll try a couple more ideas this week.
Quickly adding to this conversation that I managed to integrate fullscreen on landscape and leave fullscreen on portrait with a simple Orientation
check and some more. I will push it when I have time but here is a little example: https://github.com/bostrot/chewie/blob/master/lib/src/custom_chewie_player.dart
@bostrot Thank you very much! Do you mind adding a pull request on chewie? I think it would be nicer to only have one video player plugin. Maybe you can help @brianegan maintaining? --> https://github.com/brianegan/chewie/issues/39
I'm currently looking into how to make this work via a MethodChannel in iOS so that it will go to landscape in both iOS and Android. It is a requirement for the app I'm working on. If I can get something working (feeling like it is close) I'd be happy to contribute it back.
It may require adding an iOS folder to the plugin though for the MethodChannel implementation (which is where I'm getting stuck at the moment).
Just an update on the above - I ended up doing everything in our app code instead of modifying the plugin - setting up the MethodChannel code and changing orientation in response to the event fired when the app goes fullscreen. The plugin doesn't currently have an iOS folder for adding the MethodChannel code currently. I do believe in general, what I did could live in the plugin instead, but I ran out of time to get it implemented there.
Are there any updates on this? Is there a workaround with the method enterFullScreen()
?
Is there any updates on iOS landscape when it's in fullscreen? Did anybody done workaround for that kindly Suggest here.
@Milansu @shangarivivek I was able to achieve fullscreen on iOS by adding these line to Info.plist
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
@abilkhaiyr I tried like this,Video player landscape will work in this case,But I want remaining screen to appear only in portrait alone.Is it possible? Please suggest if any.
After several days of messing I was able to reproduce the behavior of YouTube app without modifications to plugin's code: 1) toggle fullscreen on device rotation (unless locked), 2) toggle orientation when fullscreen button is pressed.
https://gist.github.com/ihrankouski/0a353a8de649b648b3ceff0d8e97f1d7
Requires other plugin to make Flutter render widgets in specific orientation without locking it: after doing SystemChrome.setPreferredOrientations([..])
I was unable to detect device rotation any more. (I also tried listening to streams provided by this plugin and other, but they both emit orientation events too soon.)
Only tested on iphone & simulator; at least (1) should not work on Android because of https://github.com/brianegan/chewie/blob/master/lib/src/chewie_player.dart#L131.
I'm a newbie in Flutter so would appreciate any feedback.
Any updates on this issue
Any update for now?
It would be nice if the player could automatically switch to fullscreen mode when the device is currently in (or when being rotated to) landscape mode.