I am using WebRTC for video and audio and I want to support flipping the camera in a mobile device from front to back and vice versa.
Using the below code Safari iOS works great, but Android Chrome will throw the exception NotReadableError: Could not start video source
.
I am also closing any previous track.
var constraints = {
audio: false,
video: {
"width": {
"ideal": 1280
},
"height": {
"ideal": 720
},
"facingMode": {
"exact": "environment"
},
},
}
const userMedia = await navigator.mediaDevices.getUserMedia(constraints) // Will throw - NotReadableError: Could not start video source
I also tried the constraints without width and height.
{
"audio": false,
"video": {
"facingMode": {
"exact": "environment"
}
}
}
Any ideas on how to debug further or try things out will be appreciated.
[Update] Testing with Android Firefox browser works as expected!