question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[expo-video] Fullscreen on Android is locked by orientation, while iOS can rotate to landscape

See original GitHub issue

Why 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:open
  • Created 3 years ago
  • Reactions:5
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
chishing96commented, Jul 22, 2021

this issue still exist

1reaction
trentcowdencommented, Nov 24, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found