I heard this problem is a big bug but I still couldn't find a way online for a way to work around it in chrome extension. The problem I am receiving as listed above is this NotAllowedError: Failed due to shutdown The code is written below:
This is my webcam.js file:
var video = document.querySelector("#videoElement");
if (navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({ video: true })
.then(function (stream) {
video.srcObject = stream;
})
.catch(function (error) {
console.log("Something went wrong! " + error);
});
}
function stop(e) {
var stream = video.srcObject;
var tracks = stream.getTracks();
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
track.stop();
}
video.srcObject = null;
}
Video in html file
<video id = "videoElement" src="" autplay id = "video" class="video bg-black w-full h-auto mb-4"></video>
My script import is in here too! Thank you in advance for any answers, and I am looking to fix this bug!
i think it is impossible to get access to media in either popup or background script. i've also been looking for a way to get audio access but its been near impossible. i found an article online 👉 here where it says you can add a content script that targets the extension popup file itself and loads an iframe into it, here you can request audio access. i've tried it but it seems the ability to target extension files has been blocked, so i'm back to square 1.
please if you do find a solution around this, reply here so i can benefit as well .. Thanks 👍💪