I'm having some issues with the now available getUserMedia api available in the WKWebView (as of iOS 14.3).
On a page in the webview, I will access the camera using the following code:
navigator.mediaDevices.getUserMedia({
video: {
facingMode: "user"
},
audio: false
}).then(function(webcamStream) {
document.querySelector("#video").srcObject = webcamStream; /* this is a HTML video tag available on the page */
}).catch(function() {
console.log("fail")
});
This... mostly works. Unlike in Safari (and now Chrome), instead of the video element just showing what is in the video track of the webcamStream MediaStream object, it opens up a "Live Broadcast" panel and the video track pauses whenever this is closed. Is there anyway to replicate the behaviour in Safari and Chrome, where there is no panel popup?
Image of the "Live Broadcast" panel
Thanks