WebRTC on iOS

A few weeks ago Apple held WWDC, the premier developer conference for Apple developers. The big event was Apple’s keynote presentation where a lot of really cool and innovative things were announced. One thing that I noticed was missing is any mention of WebRTC support for the Safari browser. This is a big deal because a large segment of the mobile market uses iOS, and the only real web browser that you can use on your iPhone or iPad is Apple’s Safari browser.

Now I know a lot people are going to say what about Opera Mini and Chrome for iOS. Opera Mini does not conform to web standards, because it uses a proxy server in the middle to render pages into images and then simply sends a static image to an iOS device. Chrome for iOS just takes the built in Safari web browser and wraps it in a skin that looks like Chrome. Neither of these support WebRTC. So we at OnSIP set out to see if we could get WebRTC to work on iOS.

Google provides WebRTC libraries for iOS. These libraries work really well if you’re trying to create a native application that is compatible with WebRTC. But it’s not truly authentic WebRTC. One would have to re-create an application in Objective-C for proper WebRTC implementation. If you are a web developer trying to learn Objective-C to get your WebRTC application to work on an iPhone, this is not an easy task. So I continued searching for other options and I stumbled upon an open source project called PhoneRTC.

PhoneRTC takes these native WebRTC libraries and provides an interface for them to interact with Cordova. Cordova is the basis of PhoneGap, it allows people to create applications using HTML, JavaScript, CSS and package them up into a native app to put into the app store. So Cordova paired with PhoneRTC could create a native iOS app that is written completely in web languages by the end user.

Let me preface the rest of this by saying that this was designed and tested in the simplest of call scenarios. The PhoneRTC plugin supports two way audio and video calling between a browser and an iOS device. It is really just a cool tech demo, maybe with more polishing it could be used for customer facing apps but I would not recommend it currently.

The following is an overview of our SIP.js Cordova Plugin Guide.

To create a WebRTC Cordova app, create a cordova project and add the PhoneRTC Cordova plugin. This code is open source on GitHub, and Cordova has the ability to Once this is done you will need to change the build settings for the project to only build on armv7 architecture. Then in the www folder you can create your webapp. The only special work you will need to do for SIP.js is to add a custom media handler that works with the PhoneRTC API instead of the browser’s WebRTC API.

Topics: WebRTC, Business Technology