aws-samples / amazon-chime-react-native-demo

A React Native demo application for Android and iOS using the Amazon Chime SDK.
MIT No Attribution
101 stars 24 forks source link

How can we flip the mobile camera (front/rear) through chime sdk? #123

Closed sthapa1 closed 2 years ago

sthapa1 commented 2 years ago

I can't see any api on react native chime demo for flipping device camera to rear or front. Is there any way to do this?

Beos24vi commented 2 years ago

add this to your Bridge.js switchCamera: NativeModules.NativeMobileSDKBridge.switchCamera then in NativeMobileSDKBridge.m add this just after the setCameraOn function for ios

RCT_EXPORT_METHOD(switchCamera:(BOOL)isOn)
{

    [meetingSession.audioVideo switchCamera];

}

For android, in NativeMobileSDKBridge.kt add this

@ReactMethod
    fun switchCamera() {
        logger.info(TAG, "Called switchCamera")

        meetingSession?.audioVideo?.switchCamera()
    }
hokyungh commented 2 years ago

As mentioned by @Beos24vi react native does not expose all the method native sdk supports, so you would have to expose it. Feel free to open any PR to add support. Thanks!