Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox - mediaDevices.getUserMedia throws AbortError

I get the following error in firefox (no problems in Chrome / Edge / Safari):

MediaStreamError { name: "AbortError", message: "Starting video failed", constraint: "", stack: "" }

Browser console only shows < unavailable > when this error is thrown.

I am using adapter-latest.js from webrtc.github.io and the code works perfectly well on other pages within my application but not in one particular page. Is there a possibility to find out, what interferes with getUserMedia? I allready tried commenting out all other libraries and includes.

My code is:

       var video = document.getElementById('recorder');
       video.onloadedmetadata = function(e) {
           $("#takePicture").show();

           if($("#customerImage").attr("src") == ""){
               $("#recorder").show();
           }
       };
       navigator.mediaDevices.getUserMedia({ video: true})
           .then(stream => {
               video.srcObject = stream;
           })
           .catch(e => console.log(e));
like image 586
Benjamin Avatar asked Sep 19 '18 12:09

Benjamin


1 Answers

I was facing this issue because I had Chrome also running the same app and using the webcam. So basically the webcam was already in use and I was trying to access it via Firefox too.

like image 103
d_bhatnagar Avatar answered Jan 27 '23 15:01

d_bhatnagar