TheWidlarzGroup / react-native-video

A <Video /> component for react-native
http://thewidlarzgroup.github.io/react-native-video/
MIT License
7.15k stars 2.88k forks source link

react native video fullscreen not working in IOS #3269

Closed Muizz12 closed 1 month ago

Muizz12 commented 1 year ago

Bug

Platform

Which player are you experiencing the problem on:

Environment info

Library version: 6.0.0-alpha.8 Device: ios simulator

Steps To Reproduce

  1. import Video from 'react-native-video';
  2. <Video ref={videoRef} source={{uri: url}} style={styles.video} controls={true} resizeMode="contain" onBuffer={handleBuffer} onLoad={handleLoad} fullscreen={true} fullscreenAutorotate={true} fullscreenOrientation="landscape" /> ...

Expected behaviour

1.video should goto fullscreen 2.video should be played in landscape mode in fullScreen

freeboub commented 12 months ago

Did you try to use presentfullscreenplayer ? https://github.com/react-native-video/react-native-video/blob/master/API.md#presentfullscreenplayer

vinchentso-ngouen commented 10 months ago

Hello guys,

I find it best to have the video players (when in fullscreen) opened in a separate screen (navigation.push) and poped when the player is closed. (allocates space for the video so no zIndex issues) I find this to be the best and smooth way of presenting the player on fullscreen on iOS, I call the presentFullscreenPlayer when player fires "onLoad"

This is my player implementation:


  <View style={styles.container}>
            <Videoj
              source={{ uri: videoData.url }}
              style={[styles.video, styles.iOSHeight]}
              ref={videoRef}
              paused={paused}
              onLoad={onLoad}
              onError={onError}
              onFullscreenPlayerDidDismiss={onFullscreenPlayerDidDismiss}
              fullscreen={false}
              resizeMode="cover"
            />
        </View>

        *** styles *** 

    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#000',
        opacity: 0.9,
    },
    video: {
        width: 100 * vw, // - 100% width but it is using the actual size of the device from Dimensions
        height: 320,
    },
    iOSHeight: { // used to allocate space in the container if it's needed 
        height: 0.1,
    },
Divyanshu1098 commented 7 months ago

Hello guys,

I find it best to have the video players (when in fullscreen) opened in a separate screen (navigation.push) and poped when the player is closed. (allocates space for the video so no zIndex issues) I find this to be the best and smooth way of presenting the player on fullscreen on iOS, I call the presentFullscreenPlayer when player fires "onLoad"

  • isIOS - call it only for iOS (I have separate player implementation for Android - I can provide fully working fullscreen)
  • presentFullscreenPlayerOnLoad - if it is true it will open on fullscreen on playerLoad const onLoad = (data: OnLoadData) => { if (isIOS && presentFullscreenPlayerOnLoad) { videoRef?.current?.presentFullscreenPlayer(); // doesn't work on android yet } }

This is my player implementation:

  <View style={styles.container}>
            <Videoj
              source={{ uri: videoData.url }}
              style={[styles.video, styles.iOSHeight]}
              ref={videoRef}
              paused={paused}
              onLoad={onLoad}
              onError={onError}
              onFullscreenPlayerDidDismiss={onFullscreenPlayerDidDismiss}
              fullscreen={false}
              resizeMode="cover"
            />
        </View>

        *** styles *** 

    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#000',
        opacity: 0.9,
    },
    video: {
        width: 100 * vw, // - 100% width but it is using the actual size of the device from Dimensions
        height: 320,
    },
    iOSHeight: { // used to allocate space in the container if it's needed 
        height: 0.1,
    },

i'm facing the same issue can you help me on that or show the full code.

kesha-antonov commented 5 months ago

presentFullscreenPlayer not working also

"react-native-video": "^6.0.0-beta.8"

YoungYanchi commented 3 months ago

I'm also trying to use fullscreenAutorotate={true} fullscreenOrientation="landscape"

When I open full screen, the effect implied in the documentation does not happen. Can you tell me if anyone has managed to solve this problem?

With custom fullscreen everything works fine in android.

const toggleFullscreen = () => { if (!videoRef) return; if (isFullscreen) { videoRef.current.dismissFullscreenPlayer(); Orientation.lockToPortrait(); } else { videoRef.current.presentFullscreenPlayer(); Orientation.lockToLandscape(); } setIsFullScreen(!isFullscreen); };

aman-technyx commented 2 months ago

'm also trying to use fullscreenAutorotate={true} fullscreenOrientation="landscape"

When I open full screen, the effect implied in the documentation does not happen. Can you tell me if anyone has managed to solve this problem?

With custom fullscreen everything works fine in android.

const toggleFullscreen = () => { if (!videoRef) return; if (isFullscreen) { videoRef.current.dismissFullscreenPlayer(); Orientation.lockToPortrait(); } else { videoRef.current.presentFullscreenPlayer(); Orientation.lockToLandscape(); } setIsFullScreen(!isFullscreen); };

same query !

seyedmostafahasani commented 1 month ago

You can use this method. setFullScreen

aman-technyx commented 1 month ago

u saved my life @seyedmostafahasani :)

seyedmostafahasani commented 1 month ago

@KrzysztofMoch We can close this issue.

aman-technyx commented 1 month ago

@seyedmostafahasani can you tell me how can i change UI on landscape view ANDROID ?

seyedmostafahasani commented 1 month ago

You can use these libraries:

seyedmostafahasani commented 1 month ago

@freeboub @KrzysztofMoch We can close this ticket.