WebRTC in Safari

Dennis Mårtensson
Greta.io
Published in
3 min readJul 11, 2017

--

Since we started Greta.io, one of the questions we have been getting regularly, is what browsers support WebRTC? We’re happy to finally be able to include Safari on that list. This is especially positive for the European and US markets which are iOS heavy regions compared to the rest of the world.

As Apple have announced, WebRTC will now make it’s way into Safari and iOS 11. In fact, if you are a registered developer with Apple you can already try out the beta version of Safari with WebRTC support.

Of course we’ve been working on making sure that Greta works in Safari and is ready as soon as the WebRTC support comes out, and we wanted to share a few things we’ve noticed when testing WebRTC in Safari so far:

For us, it has so far proven relatively easy getting Safari, Chrome and Firefox connecting to each other. One thing that we did however run into is that setting the session description protocol on the offer or the answer will throw the following error:

TypeError: Attempted to assign to readonly property.
  • Using the WebRTC stats API is also a bit different compared to for example Chrome. If used without a selector in Chrome you get a number of stats, but doing the same in Safari will throw the following error:
Argument 1 (‘selector’) to RTCPeerConnection.getStats must be an instance of MediaStreamTrack
  • In other browsers, we create multiple Datachannels on the same Peer Connection, which does not seem to be supported in Safari. It might be that Apple is planning to add it later on, but either way it is something that we are able to work around. We would however preferred it if Safari worked in the same way as the other browsers as that enables faster data delivery.

This is just a short note on what we have been seeing so far. If anyone else have tried it too and would like to discuss it more, feel free to reach out directly to me at dennis@greta.io.

We are generally very happy with Safari and WebRTC, and believe it is a great step forward for WebRTC in general that the last big player joins the ecosystem.

Greta.io is dedicated to helping users increase site performance via an innovative approach to content delivery. We use machine learning to make content routing decisions in the client based on real-time network data. For every piece of content, Greta automatically decides if the content should be delivered over multi-CDN, peer-to-peer, client cache or an overlay network. As a result, customers experience shorter content load times, higher content quality and server offload during peak traffic.

--

--