First time load page, EVERYTHING IS OK with navigator.mediaDevices.getUserMedia, video can play camera.
But when I refresh the page, navigator.mediaDevices.getUserMedia throw an error 'Failed to create video trackr' error name is 'ConstraintNotSatisfiedError'.
I thought the reason is IE does not close the camera when I refresh the page. So I added a listener
window.addEventListener('beforeunload', function () {
if (stream) {
// works fine
stream.getTracks().forEach(track => {
track.stop();
});
}
})
'stream' is getUserMedia resolve data. But can't work.
Also, I found that the camera light is closed. But when I refresh the page , it still throw the error.
What can I do to make the camera fine when I refresh the page?
ENV: IE11 , Edge
First time load page, EVERYTHING IS OK with
navigator.mediaDevices.getUserMedia
, video can play camera.But when I refresh the page,
navigator.mediaDevices.getUserMedia
throw an error 'Failed to create video trackr' error name is 'ConstraintNotSatisfiedError'.I thought the reason is IE does not close the camera when I refresh the page. So I added a listener
'stream' is getUserMedia resolve data. But can't work. Also, I found that the camera light is closed. But when I refresh the page , it still throw the error.
What can I do to make the camera fine when I refresh the page?