https://caniuse.com/?search=getusermedia
Based on the link provided above, does Safari 15 support getUserMedia? I trying use it to access camera, when I test it on safari 15 it asked camera permission, after I allow the permission it still show me nothings. The link show Safari 15 is support getUserMedia/Stream API but not support Navigator API: getUserMedia. Below is my code, which one I should refer to? getUserMedia/Stream API or Navigator API: getUserMedia
navigator.mediaDevices
.getUserMedia(constraints)
.then(function (stream) {
track = stream.getTracks()[0];
cameraView.srcObject = stream;
})
.catch(function (error) {
console.error("Oops. Something is broken.", error);
});
HTML
<video id="camera--view" autoplay></video>
after I allow the permission it still show me nothings
I solved it by adding muted and playsinline in html. Base on what I know iOS will not allow autoplay when the video does not playsinline and muted.
<video id="camera--view" muted autoplay playsinline></video>