Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Landscape orientation not working properly on iOS devices #48

Open
Veryinheart opened this issue Feb 19, 2024 · 7 comments
Open

Landscape orientation not working properly on iOS devices #48

Veryinheart opened this issue Feb 19, 2024 · 7 comments

Comments

@Veryinheart
Copy link

Veryinheart commented Feb 19, 2024

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",
@Veryinheart Veryinheart changed the title Camera view rotate 90 degrees or lock to portrait mode on landscape mode on iOS devices Landscape orientation not working properly on iOS devices Feb 19, 2024
@stalteri
Copy link

stalteri commented Jun 5, 2024

same issue

@AshhadKhan55
Copy link

any solution yet?

@stalteri
Copy link

stalteri commented Jul 3, 2024

any solution yet?

I switched to another package

@AshhadKhan55
Copy link

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

@stalteri
Copy link

stalteri commented Jul 3, 2024

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

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

@stalteri
Copy link

stalteri commented Jul 3, 2024

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

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

@AshhadKhan55
Copy link

@stalteri thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants