[expo-video] Fullscreen on Android is locked by orientation, while iOS can rotate to landscape
See original GitHub issueWhy was this issue closed? => https://github.com/expo/expo/issues/6864 I added my “Hotfix”-Code for the bug but I think this issue should be fixed as the native controls of the video-player should also support rotating without manually unlocking the orientation-mode
My hotfix for now (for anyone who is interested):
New working version inspired by @bapjiws (typescript):
import * as ScreenOrientation from 'expo-screen-orientation';
import {Platform} from 'react-native';
const videoRef = useRef<any>() // Note: No idea which type i should use here
const onFullscreenUpdate = async ({fullscreenUpdate}: VideoFullscreenUpdateEvent) => {
if (Platform.OS === 'android') {
switch (fullscreenUpdate) {
case Video.FULLSCREEN_UPDATE_PLAYER_DID_PRESENT:
await ScreenOrientation.unlockAsync()
break;
case Video.FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS:
await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT)
break;
}
}
const showVideoInFullscreen = async () => { await videoRef.current.presentFullscreenPlayer() }
<Button title="Play video" onPress={showVideoInFullscreen} />
<Video
ref={videoRef}
source={{uri: videoSource}}
resizeMode={ResizeMode.CONTAIN}
useNativeControls={true}
onFullscreenUpdate={onFullscreenUpdate}
/>
Anyways, I think this is a bug and should be fixed.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:14 (4 by maintainers)
Top Results From Across the Web
ScreenOrientation - Expo Documentation
To put the matter shortly, for the iOS, your iPad is always in the landscape mode unless you open two applications side by...
Read more >Rotate expo video player in full-screen landscape mode.
This is how you can rotate the expo video player in full-screen landscape mode. ... and sharing your React Native apps on iOS...
Read more >React Native Expo Video av-expo - Stack Overflow
When the button is pressed, a video component is rendered in fullscreen mode, portrait orientation. When exiting from fullscreen, the video ...
Read more >Expo Android Video Reader Rotate Video On It's Own - ADocLib
[expovideo] Fullscreen on Android is locked by orientation while iOS can rotate byCedric added AV ScreenOrientation Video Android enhancement and On iOS.
Read more >expo video orientation, react-native-orientation not working ...
We can do this by simply putting 1 line of code in android and in iOS we have to perform a specific step....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
this issue still exist
Are there any updates on a fix for this? I have a screen that isn’t designed to be in landscape but I want to be able to have fullscreen in landscape on android. The workaround by @mleister97 is ok but causes some janky/buggy behavior. Ideally, on Android, it would behave the same as iOS and override the orientation lock when fullscreen is active.