简体   繁体   中英

Enable WebRTC Support in WKWebView/UIWebView

I am developing a flutter application using WebRTC in webview . On android, it is working as expected, but facing issues on iOS build. I have read the threads Apple Support and SO Thread .

Both threads state, WebRTC is not allowed inside iOS webview. I tested my code in emulator/real-device, but unsuccessful.

So, my question is anybody know how can I run the WebRTC in iOS webview?

This is how I am showing the webview

InAppWebView(
                initialUrl: widget.callType == AppConstant.INCOMING ? incomingUrl : outGoingUrl,
                initialOptions: InAppWebViewGroupOptions(
                  crossPlatform: InAppWebViewOptions(
                      mediaPlaybackRequiresUserGesture: false,
                      debuggingEnabled: true,
                      clearCache: true,
                      javaScriptEnabled: true,
                      preferredContentMode: UserPreferredContentMode.MOBILE
                  ),
                ),
                onWebViewCreated: (InAppWebViewController controller) {
                  //web view created
                },
                androidOnPermissionRequest: (InAppWebViewController controller, String origin, List<String> resources) async {
                  print('resource list : ${resources.toString()}');
                  return PermissionRequestResponse(resources: resources, action: PermissionRequestResponseAction.GRANT);
                }
            );

ios Webview and WKWebView hasn't had WebRTC support until now.

From ios 14.3 ios is offering support for WKWebView: https://leemartin.medium.com/ios-14-3-brings-webrtc-to-wkwebview-closing-gap-on-ios-accessibility-90a83fa6bda2

You need to update your iOS in your phone and/or Xcode 12.3.

Additionally, depending on your webview plugin ( in my case I am using cordova-plugin-inappbrowser) could be necessary to modify it to add permissions for video, camera, and VoIP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM