简体   繁体   English

在 WKWebView/UIWebView 中启用 WebRTC 支持

[英]Enable WebRTC Support in WKWebView/UIWebView

I am developing a flutter application using WebRTC in webview .我正在使用 webview 中的WebRTC开发 flutter 应用程序。 On android, it is working as expected, but facing issues on iOS build.在 android 上,它按预期工作,但在 iOS 版本上遇到问题。 I have read the threads Apple Support and SO Thread .我已阅读线程Apple SupportSO Thread

Both threads state, WebRTC is not allowed inside iOS webview. state、WebRTC 两个线程都不允许在 iOS Z5A98E2840FD0141780D47Z8D47Z6 内。 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?所以,我的问题是有人知道如何在 iOS webview 中运行 WebRTC 吗?

This is how I am showing the webview这就是我展示 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. ios Webview 和 WKWebView 到目前为止还没有 WebRTC 支持。

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 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.您需要在您的手机和/或 Xcode 12.3 中更新您的 iOS。

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.此外,根据您的 webview 插件(在我的情况下,我使用的是 cordova-plugin-inappbrowser),可能需要对其进行修改以添加视频、摄像头和 VoIP 的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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