BabylonReactNative
BabylonReactNative copied to clipboard
VideoTexture.CreateFromWebCam doesn't properly request camera permissions
Due to the complexity of requesting permissions on different platforms (particularly Android) the current implementation of VideoTexture.CreateFromWebCam fails on Android if it has to prompt the user for permissions. The prompt shows up, but the VideoTexture doesn't load because it's not properly awaiting the camera permission. It does however work if the camera permission was previously granted to the app.
A work-around was added specifically for the camera permission when entering XR: https://github.com/BabylonJS/BabylonReactNative/blob/410290dced6ba6d0b0a8df13145acc76a94acfc6/Modules/%40babylonjs/react-native/EngineHook.ts#L29
A similar work-around should be added for VideoTexture.CreateFromWebCam as well.