using webrtc code on my cordova app

Niko Vincent picture Niko Vincent · Mar 3, 2018 · Viewed 8.3k times · Source

Im trying to use webRTC API such as getUserMedia and RTCPeerConnection for my app which is built with the cordova framework.

I am wondering if its possible for webRTC to work on both Android and iOS since my video chat app is a hybrid app (js and html) which is supposed to manage the entire p2p video chat by itself, unlike pc versions which require a web browser for the webRTC communication.

Answer

William Fleming picture William Fleming · Mar 4, 2018

Yes, It is possible to get them to work. Keep in mind, the architecture of cordova application is reliant on a Web View rendering of your application. That web view will need to provide the WebRTC APIs to consume in JavaScript. This 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 for accomplishing this. I have seen a couple of plugins for Cordova that enable access to native code so you are not as reliant on the Web View.

cordova-plugin-iosrtc

phonertc

Good luck!