Android : Camera.recordAsync() doesn't work on front camera
See original GitHub issueCalling Camera.recordAsync() on the back camera works fine. Calling it on the front camera resulting in error : recordAsync: Expected a Camera component
[Unhandled promise rejection: Error: recordAsync: Expected a Camera component]
- node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:123:42 in createErrorFromErrorData
- node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:80:57 in <unknown>
- …
Environment
I am testing it on actual devices, in the Expo app Expo 25.0.0 React-native 0.52.0
OnePlus One Android 7.1.2 (Lineage OS)
Samsung Galaxy S2 Android 6.0.1 (Lineage OS)
Steps to Reproduce
startVideo = async () => {
if ( !this.camera ) return;
try {
const data = await this.camera.recordAsync({ });
console.log( data);
} catch ( error) {
throw error;
}
}
// Back : Works
<Camera
ref = { (cam) => { this.camera = cam; } }
style = { styles.preview }
type = { Camera.Constants.Type.back }/>
<Text style={ styles.capture } onPress={ this.startVideo.bind(this) }>[START]</Text>
// Front : Error "Expected a Camera component"
<Camera
ref = { (cam) => { this.camera = cam; } }
style = { styles.preview }
type = { Camera.Constants.Type.front}/>
<Text style={ styles.capture } onPress={ this.startVideo.bind(this) }>[START]</Text>
The only difference is the camera type In both case, the preview frame is working properly, I can see what the front camera see, but video recording not working from front camera
Snack
Press “Start” to start recording Press “Stop” to stop recording At the end, the message “Good” appear below the camera preview
Back Camera : OK https://snack.expo.io/SyB-LVZLG
Front Camera : Error (App Crash) when “Start” is pressed https://snack.expo.io/SyJaLEWIM
The only diffrence is on line 54
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:8 (2 by maintainers)
Sorry for that, looking into the issue 🤔
Bump…I have the same issue with Android Front facing camera calling a error: camera is not running.