6

I'm trying to use getUserMedia on iOS 14.4 with WKWebView within a Cordova app. I'm using the HelloWorld app from Cordova to reproduce this.

I provided the NSCameraUsageDescription string.

I'm using the sample code as provided on https://webkit.org/blog/11353/mediarecorder-api/ (but with audio set to false).

When I first launch the app and click the button to start the stream, the permission request comes up, which I confirm. Then this error occurs: "NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission"

Afterwards the permission request will not come again, only after I re-install the whole app.

Am I doing anything wrong? From what I understood, getUserMedia should be available in iOS 14.4 for apps based on WKWebView, right?

johnborges
  • 2,422
  • 20
  • 33
qpwr
  • 408
  • 3
  • 15
  • For general Camera use you need a plugin:https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/. If you're trying to do something with WebRTC look here: https://github.com/remotium/cordova-plugin-webrtc – johnborges Jan 27 '21 at 13:33
  • Could you please explain how that helps with the question? the getUserMedia API should be fully exposed starting from iOS 14.3, so there should no plugins be needed in order to use it. – qpwr Jan 27 '21 at 14:34
  • Does this answer your question? [Cordova: getUserMedia() no longer works on insecure origins](https://stackoverflow.com/questions/55024404/cordova-getusermedia-no-longer-works-on-insecure-origins) – johnborges Jan 27 '21 at 20:10
  • 1
    Not really, no. As I mentioned, I'm using iOS 14.4 and the issue with insecure origins should have been fixed in this version (see https://bugs.webkit.org/show_bug.cgi?id=220184), which would include apps based on WKWebView (as mentioned in my original question). – qpwr Jan 28 '21 at 06:35

1 Answers1

6

Update: The feature has been rolled out as part of iOS 14.5.

Original comment: Webkit developers just confirmed to me via mail that the fix which addresses the usage of getUserMedia in app bundle contexts is not part of iOS 14.4 and will probably be part of one of the next betas of iOS 14.

Just in case you want to keep track of any possible progress: https://bugs.webkit.org/show_bug.cgi?id=220184 (the entry is not guaranteed to be updated by the folks)

qpwr
  • 408
  • 3
  • 15
  • 2
    I'm really glad there's someone else out there who tested getUserMedia on 14.4 right away. Thanks for following up. – Kevin Ashcraft Jan 28 '21 at 21:41
  • It's still undefined on 14.8. – alekop Nov 02 '21 at 19:31
  • It's confirmed to be in iOS 14.5, @alekop. I use it myself. If it's not working for you, you're doing something wrong. – qpwr Nov 02 '21 at 23:03
  • 1
    @qpwr, Yes, I was missing the microphone permission. You need to add both camera, and microphone permissions in the .plist file. – alekop Nov 03 '21 at 18:49