在我的 cordova 应用程序上使用 webrtc 代码

using webrtc code on my cordova app

我正在尝试为使用 cordova 框架构建的应用程序使用 webRTC API,例如 getUserMedia 和 RTCPeerConnection。

我想知道 webRTC 是否可以在 Android 和 iOS 上工作,因为我的视频聊天应用程序是一个混合应用程序(js 和 html),它应该自己管理整个 p2p 视频聊天,不像 pc 版本需要网络浏览器进行 webRTC 通信。

是的,让他们工作是可能的。请记住,cordova 应用程序的体系结构依赖于应用程序的 Web 视图呈现。该 Web 视图将需要提供 WebRTC API 以在 JavaScript 中使用。这 thread suggest the web view in iOS 11 does not support it. In fact, it is pretty new to Safari all together. This documentation says that the latest versions of Android Web Views do have support. WebRTC is a collection of technologies that enables RTC, and there are native libraries 为了完成这个。我已经看到几个 Cordova 插件可以访问本机代码,因此您不那么依赖 Web 视图。

cordova-plugin-iosrtc

phonertc

祝你好运!