ezranbayantemur / react-native-rtmp-publisher

📹 Live stream RTMP Publisher for React Native
MIT License
104 stars 16 forks source link

Landscape orientation not working properly on iOS devices #48

Open Veryinheart opened 9 months ago

Veryinheart commented 9 months ago

At first, nice package and thanks for your contribution.

### Current Behavior

I lock stream screen to landscape mode with a package call 'react-native-orientation-locker', and the camera view did lock to landscape mode on android devices. However, it doesn't work with iOS devices, the camera view is still use portrait mode and it seems like it rotate 90 degrees with weird zoom out view.

It seems like when the camera got invoked or RTMPPublisher component got initialized, the orientation hasn't locked to landscape mode so the camera still take portrait view.

Does rtmp-publisher camera locked to portrait on iOS devices by default or any way we can change the camera orientation mode?

Stream screen component
...other code
 const [orientation, setOrientation] = useState()

 useEffect(() => {
        setTimeout(() => Orientation.lockToLandscape(), 1000)
        Dimensions.addEventListener('change', ({window: {width, height}}) => {
            if (width < height) {
                setOrientation('PORTRAIT')
            } else {
                    setOrientation('LANDSCAPE')
            }
        })
    }, [])
return (
    <View style={styles.container}>
        <StatusBar hidden={true} />
        {permissionGranted && orientation === 'LANDSCAPE' && (
            <RTMPPublisher
                ref={publisherRef}
                streamURL={streamUrl}
                streamName={streamKey}
                style={styles.camStyle}
                onConnectionFailed={handleOnConnectionFailed}
                onStreamStateChanged={handleOnStreamStateChanged}
            />
        )}

...other code `

Packages:

"react-native": "0.72.10", "react-native-rtmp-publisher": "^0.4.7", "react-native-orientation-locker": "^1.6.0",

stalteri commented 5 months ago

same issue

AshhadKhan55 commented 4 months ago

any solution yet?

stalteri commented 4 months ago

any solution yet?

I switched to another package

AshhadKhan55 commented 4 months ago

@stalteri can you please refer me to the package which is working fine?

stalteri commented 4 months ago

@stalteri can you please refer me to the package which is working fine?

of course, its @api.video/react-native-livestream

stalteri commented 4 months ago

@stalteri can you please refer me to the package which is working fine?

https://github.com/apivideo/api.video-reactnative-live-stream

AshhadKhan55 commented 4 months ago

@stalteri thanks