Does iOS 11 WKWebView support WebRTC ?

On iOS 11 I can run a web application that performs a WebRTC on Safari but when I write my own application using swift 4 and WKWebView it does not work!


Anybody know how to run WebRTC on WKWebView in iOS 11 ? or it is not supported this way?


Thanks.

Replies

FYI, posting +1’s here won’t help. If you feel the need to +1 this, please follow the advice from my 30 Jan 2019 post.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

+1, I need this feature

Disappointed that it doesnt seem to be supported in iOS13 Beta

+1 I've seen this feature working in IOS 13 beta build 1, but after the second beta build it got regressed.
Any idea when you are getting this fixed? I't already been a few years and it's still not fixed....

As pointed out in few earlier replies from Eskimo (Apple Developer Relations representative), if you want it, you need to make a feature request, in Feedback Assistant, which you can get to by the "Report Bugs" link at the bottom of this page. The more the reports, the more attention it seems to get within Apple engineering. As I understand it, Apple engineers seldom frequent these forums, and Apple management (those that allocate resources to problems), frequent these forums even less. All you are doing is ranting at your fellow developers, who, by the way, most likely agree with you, and have agreed with you for a long time, based on the length of this thread. As far as an ETA is concerned, Apple will let you know when Apple lets you know. They don't usually divulge their plans except within Apple events such as WWDC and the like. Like always, develop according to what the state of the system is today, and what has been officially divulged by Apple at WWDC, et al.

Is Webrtc getUsermedia works in SafariViewController or WkWebview?

Hey everyone, we wrote an open source swift shim for the missing WebRTC functionality for WKWebView:

https://github.com/OpenTelecom/WKWebViewRTC

Big thanks to the Cordova project!
NoahMehl, I saw your repo, it has missing support for facilitating a video call, is this intentional?
iOS 14.3 Supported
WebRTC is supported now. There are some steps you will want to take to get certain types of content working, though (e.g. a video stream).

First, make sure you are targeting an iOS version that is new enough to be supporting it. 14.3 works for me.

Next, some types of content are blocked by default for security purposes, but you can unblock them by adding the following keys to your info.plist file (right click and choose view as source code to add them):
Code Block
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
</dict>

Be sure to check into the consequences of adding these keys and be vigilant about what kind of content you are accessing in the WebView.

Hopefully this works if you were still having issues accessing WebRTC content in a WKWebView.
  • Asking with hopes that someone has run into or replicated or even resolved this issue:

    In my WKWebView (targeting both macOS 11.0 & 12.4), navigator.mediaDevices.getUserMedia() hangs as promise when called, and never shows a prompt as one expects when running this on e.g. https://google.com.

    Full write-up with info, MCVe, etc found here: https://developer.apple.com/forums/thread/734363

    Also added the NSAllowsArbitraryLoads option (described above) to "try everything".

Add a Comment

Asking with hopes that someone has run into or replicated or even resolved this issue:

In my WKWebView (targeting both macOS 11.0 & 12.4), navigator.mediaDevices.getUserMedia() hangs as promise when called, and never shows a prompt as one expects when running this on e.g. https://google.com.

Full write-up with info, MCVe, etc found here: https://developer.apple.com/forums/thread/734363

As previously suggested, I've added:

<key>NSAppTransportSecurity</key>
<dict>
		<key>NSAllowsArbitraryLoadsInWebContent</key>
		<true/>
		<key>NSAllowsArbitraryLoadsForMedia</key>
		<true/>
</dict>

and also NSAllowsArbitraryLoads with no luck.

To be clear, navigator.mediaDevices.getUserMedia() and navigator.mediaDevices.enumerateDevices() are both defined:

  • getUserMedia() hangs on promise
  • enumerateDevices() returns an single (default) MediaInfoDevice audioinput before & after asking permissions (via getUserMedia or native microphone permissions via AVCaptureDevice)