iOS 11(测试版)中的webKit是否支持WebRTC? [英] Does webKit in iOS 11 (Beta) support WebRTC?

查看:388
本文介绍了iOS 11(测试版)中的webKit是否支持WebRTC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与iOS11(测试版)上的Safari兼容的URL.音频/视频正常运行. 但是,当我用WKWebView加载此URL时,它给我一个错误不兼容的浏览器",当我在WebKit中检查我的浏览器版本时,它显示"iOS 11上基于WebKit的浏览器"

真正的问题是,苹果是否已为iOS 11开发人员BETA在WKWebview Webkit(应该与Safari相同)中包含此更改?

解决方案

自iOS11起,

Safari App 浏览器中的 WKWebView
完全受支持的部分支持 WebRTC.


说明:

WebRTC具有三个主要的JavaScript API:

  • MediaStream(又名getUserMedia)
  • RTCPeerConnection
  • RTCDataChannel

对于在 Safari应用 iOS11 +中运行的应用,支持所有WebRTC API.其中包括getUserMedia.确保使用 adapter.js 库以获得最佳兼容性,因为每个浏览器(包括Safari)都使用不同的名称来实现.例如,在Safari中为navigator.mediaDevices.getUserMedia().

但是,当使用 WKWebView SFSafariViewController 时,情况就不同了:

您仍然可以流式传输视频&来自本地存储的音频或使用对等方捕获的实时媒体.希望在iOS 12中我们能看到一些进步...

I have a URL that is working fine with Safari on iOS11 (Beta) Audio/Video is working fine. But when I load this URL with WKWebView it gives me an error "Incompatible Browser" and when I check my browser version in WebKit it shows "WebKit based browser on iOS 11"

So the question really is, has Apple included this change in the WKWebview webkit (which should be the same as Safari) for the developer BETA of iOS 11?

解决方案

Since iOS11,

WebRTC is partially supported in WKWebView,
and fully supported in the Safari App browser.


Explained:

WebRTC has three main JavaScript APIs:

  • MediaStream (aka getUserMedia)
  • RTCPeerConnection
  • RTCDataChannel

For apps running inside Safari App, iOS11+, all WebRTC APIs are supported. That includes getUserMedia. Be sure to use adapter.js library for best compatibility, since each browser - including Safari - uses a different name for its implementation. For example, in Safari it's navigator.mediaDevices.getUserMedia().

But, when using WKWebView or SFSafariViewController, it's a different story:

You can still stream video & audio from local storage or consume live media captured by a peer. Hopefully in iOS 12 we'll see some progress...

这篇关于iOS 11(测试版)中的webKit是否支持WebRTC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆