NotReadableError: could not start video source

13,305 views
Skip to first unread message

KS

unread,
Jul 11, 2019, 8:45:33 AM7/11/19
to discuss-webrtc
Hi WebRTC,

I am trying to develop Video Recording from Front as well as Rear Camera using WebRTC.
Front camera recording & saving video works fine, but when I select rear camera and starts Video Recording the NotReadableError: could not start video source error occurs.

Kindly provide the solution.

Thanx in advance.

Regards,
KS

Henrik Andreasson

unread,
Jul 11, 2019, 8:48:57 AM7/11/19
to discuss-webrtc
Which APIs are utilized and what platform is used? Is it a web-based client or a native client? Can you provide a link to a demo application?
If it is a web-based application; did you give permission to the camera?

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/c2fbc1d1-eca5-4ced-ac54-07efa814ba36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Miroslav Pejic

unread,
Jun 15, 2021, 7:10:19 AM6/15/21
to discuss-webrtc
Hi KS,
Try to stop your Video Track (YOUR_STREAM.getVideoTracks()[0].stop();),
before to call again navigator.mediaDevices.getUserMedia to switch on Rear camera....

Miroslav Pejic

unread,
Jun 15, 2021, 8:22:23 AM6/15/21
to discuss-webrtc
Take a look also on this common getUserMeda errors:
https://blog.addpipe.com/common-getusermedia-errors/

Benjamin Grandfond

unread,
Jun 19, 2021, 2:21:30 PM6/19/21
to discuss-webrtc
Hi KS,

I recommend you to have a look at Twilio's documentation that lists the media errors: https://www.twilio.com/docs/video/build-js-video-application-recommendations-and-best-practices#media-errors
But for your error there is one case missing. I faced the same and it was because
  • the browser is not authorized to access the camera (valid on Chrome and Edge on Windows)
  • a process already uses the camera (valid on Chrome and Edge on macOS)
In the first case I think navigator.mediaDevices.getUserMedia would fail immediately, the user won't see the authorization dialog. I am not really sure how to detect that but maybe you can try/catch the call to getUserMedia and try to call enumerateDevices within the catch. If there are no devices with id AND label it means the browser is not authorized (on Chrome you will have the default devices in the list but without the id or the label, I don't fully remember).

For the second case it happens when the user granted access to the devices. When calling the enumerateDevices you will have the list of all the devices so you can be sure that the cause of your problem is that they might be already in use: a media track already exists or a process already takes the process but it is most likely the first option witch Chrome and Edge. I don't recall having this issue on Safari or Firefox, I think the message and/or the error would have been different.

Hope I am not fully wrong and it helps :)

Best,
Benjamin

guest271314

unread,
Jun 20, 2021, 1:26:46 PM6/20/21
to discuss-webrtc
If two USB devices are connected to the same USB hub, if the width and height exceed 320x240 the error that you refer to can occur. See https://groups.google.com/g/discuss-webrtc/c/rRaZP19tqZA/m/EytpO-ljBwAJ.
Reply all
Reply to author
Forward
0 new messages