AdapterJS
AdapterJS copied to clipboard
IE11 refresh page fail to create video track (IE can't close camera)
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
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?
The pointer is can't close the camera in IE, any way can make this?