Search code examples
cordovauiwebviewgetusermedia

Is it possible to use navigator.getUserMedia in a UIWebview


I'm trying to capture video that I embed in the page and overlay canvas on top of it. The example I'm playing with http://auduno.github.io/clmtrackr/face_mask.html

It works fine in the browser but when I use PhoneGap to make it into an iOS app the camera request does not appear. I looked at a couple camera plugin examples but I don't see any that will actually embed the video in the video tag. So I'm trying to figure out how to stream the camera with HTML5. Is there a way to grant permission on the UIWebview to do this?

    navigator.getUserMedia(videoObj, function(stream) {
        video.src = stream;
        video.play();
    }, errBack);

Solution

  • It seems that it is not currently possible to directly access the camera from a UIWebView. I've been trying to do this as well, but there's nothing that I have found to work.

    FYI See: Access iPhone's camera from UIWebView using HTML 5

    Edit: digging a little deeper, it looks like people have managed to get the video into the UIWebView, but they're not using navigator.getUserMedia https://github.com/arasbm/DemoNativeToJS