In react-native-video player can go to landscape mode if rotation locked to portrait in Xcode settings
I'm also interested in this feature being built in to this project.
I believe you could use https://github.com/yamill/react-native-orientation in tandem with this project. The problem with this approach is that you would have to disable the locked to portrait in xcode because this setting from my R&D experience is that this setting is NOT overwritable with the current libraries and orientation support in React Native. With this setting off, you can use react-native-orientation to "lock" to portrait on EVERY view with the exception of the views you'd like to allow landscape. In your case, the view where react-native-video is being rendered. This is less then ideal but I think would work.
@larryranches Do you know how react-native-video do that without additional setup?
@max-mykhailenko You'll have to use the same approach. The problem is not really the video component. It's the handling of the orientation.
@larryranches I enable only portrait orientation in Xcode Info.plist, but react-native-video rotate according to orientation and never mind to the setting. I'll look sources of react-native-video and maybe find something helpful.
@max-mykhailenko I'm very interested by this feature as well, let me know if you have any leads, I'm willing to contribute. If not, I will try to implement the solution proposed by @larryranches (locking the orientation at the RN level and unlock it while in full screen).
@max-mykhailenko I ended up implementing the solution from @larryranches and it works great!
<YouTube
videoId="gZwEfUuvIVU"
onFullScreenEnter={() => Orientation.unlockAllOrientations()}
onFullScreenExit={() => Orientation.lockToPortrait()}
/>
@wcandillon Are you locking every view in your project then unlocking only the views that you'd like to install landscape?
@larryranches correct.
On my main class I have:
componentDidMount() {
Orientation.lockToPortrait();
}
@wcandillon Also wondering what Larry asked: are you locking every view in your project then unlocking only the views that you'd like to install landscape?
@GeoffreyPlitt you should lock only root view and all children will be locked. After fixing callbacks for RN 0.40 all works with https://github.com/yamill/react-native-orientation library. Thanks, guys!
Current working release 0.8.1
I was looking for a feature like this and then I noticed that after updating iOS to 11 I can rotate the video in fullscreen mode without the need of react-native-orientation or any other custom setup. Which is nice.
Most helpful comment
@max-mykhailenko I ended up implementing the solution from @larryranches and it works great!