react-native-twilio-video-webrtc
react-native-twilio-video-webrtc copied to clipboard
FlipCamera error
Hello,
twilioRef?.current?.flipCamera() throws an exception while I try to flip camera when denied permissions to camera usage on iOS platform.
How can I catch this error? flipCamera() method returns undefined

While the error handling could be improved, I think the best way to avoid this would be to disable the camera flip behavior until the camera has started. You can know what that happens by listening to the onCameraDidStart event.
It was helpful, thank you. I have another question on android you cannot connect to session if you don't have camera permissions ([FailToConnect]ERROR: {"error": "No camera is supported on this device"}), on iOS you can connect but for example flip throws an error, wouldn't be great to unify those behaviour?
Also I have question about android, when the app asks for permissions first time and we deny it, and then app asks again Twilio still throws [FailToConnect]ERROR: {"error": "No camera is supported on this device"}. The same situation after denying the first ask and changing permissions in device setting. It disappears only after restarting the app and this is kind of problematic. Can I somehow force Twilio to refresh?
@slycoder can you look into this?
Before asking again, you might need to unmount the twilio video component and remount it.
How can I unmount that component?
You can add a state variables, like isAskingForPermissions, and then guard the twilio video component with that:
{!isAskingForPermissions && <TwilioVideo ... />}
So that once isAskingForPermissions is true, then the component will be unmounted, and when it becomes false again, it will be remounted.