Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NotReadableError: Failed to allocate videosource

I get this error in Firefox 51 when I try to execute the following code and when I select my laptop's camera:

navigator.getMedia = (navigator.getUserMedia ||   navigator.webkitGetUserMedia ||   navigator.mediaDevices.getUserMedia ||   navigator.msGetUserMedia);  navigator.getMedia({     video: true,     audio: false   },   function(stream) {     if (navigator.mozGetUserMedia) {       video.mozSrcObject = stream;     } else {       var vendorURL = window.URL || window.webkitURL;       video.src = vendorURL.createObjectURL(stream);     }     video.play();   },   function(err) {     console.log("An error occured! " + err);   } ); 

Error:

NotReadableError: Failed to allocate videosource 

Can someone elaborate what this means? Is my webcam broken? I used it from the script just yesterday without problems. It's not allocated to other application.

like image 585
Tomáš Zato - Reinstate Monica Avatar asked Mar 03 '17 00:03

Tomáš Zato - Reinstate Monica


People also ask

What does NotReadableError mean?

NotReadableError is the spec compliant error thrown by Firefox when webcam access is allowed but not possible. Most commonly this happens on Windows because the webcam is already in use by another app.

Could not connect to your default camera NotReadableError could not start video source?

If you are receiving the message “The webcam is in use by another application” or “NotReadableError: Could not start video source” check that your webcam is not in use by another application such as Skype or Facebook video chat. First, if you have ManyCam installed, first upgrade it to the latest version.


2 Answers

NotReadableError is the spec compliant error thrown by Firefox when webcam access is allowed but not possible.

Most commonly this happens on Windows because the webcam is already in use by another app. Firefox will throw this error on both Windows and Mac even though only on Windows processes get exclusive access to the webcam.

The error can happen for other reasons:

Although the user granted permission to use the matching devices, a hardware error occurred at the operating system, browser, or Web page level which prevented access to the device.

Chrome throws TrackStartError instead. It also throws it for other reasons. Chrome tabs can share the same device.

Source: common getUserMedia() errors .

like image 148
Octavian Naicu Avatar answered Sep 19 '22 14:09

Octavian Naicu


Please make sure your camera is not been used by some other application (chrome, ie or any other browser). I wasted half my day searching for a solution, and in the end, found out my camera was used by other application.

like image 27
Shashank Avatar answered Sep 20 '22 14:09

Shashank