iPad Safari: How to resume <video> after Safari go to foreground again

Viewed 46

I have a <video> element which connects stream from camera, when I switched the Safari to background and bring to foreground again, the video becomes black.

How to make the play stream from camera again when it comes foreground?

  // Get access to the camera!
    if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
        // Not adding `{ audio: true }` since we only want video now
        navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) {
            //video.src = window.URL.createObjectURL(stream);
            video.srcObject = stream;
            g_stream = stream;
            video.play();
        });
    }
0 Answers
Related