While developing video chat with angular, I faced this issue.
ngOnInit() {
navigator.mediaDevices && navigator.mediaDevices.getUserMedia({audio:true, video: true})
.then(res=> console.log(res))
.catch(err => console.log("err: ", err));
}
Console result:
err: DomException: Could not start video source
This works well on Desktop/Chrome, but never works on Android/Chrome. I tested it on Android Emulators such as Nox App Player and Bluestacks.
I've hosted the angular project with this command.
ng serve --host MY_IP_ADDRESS --disable-host-check --ssl
Twilio developer evangelist here.
When you test this on an Android device, are you doing so on localhost or over HTTPS? You can only use getUserMedia on a secure domain or localhost.
If I need to test on a device, I use ngrok to tunnel to my localhost. You can then access the ngrok URL over HTTPS.
Another reason this might not work is that you're using the camera in another application or browser tab, and the device only allows access to the camera from one application at a time.
For the emulators, make sure you have cameras configured correctly within the emulator.