Announcing WebRTC and Media Capture

Today we are thrilled to announce WebKit support for WebRTC, available on Safari on macOS High Sierra, iOS 11, and Safari Technology Preview 32. In this post, we will go through an overview of our implementation. We will have future posts that cover more best practices for developers.

When talking about WebRTC, we immediately think about making a video conference call. There are two steps to start a call. First, WebKit needs access to the user’s camera and microphone. HTTPS websites use the Media Capture and Streams API on Safari for that purpose. Once the user grants permission through a prompt, capture streams start to flow. These streams can be tailored to websites’ needs through the use of constraints.

Second, the user joins the conversation, once he checks to make sure his hair looks good on-screen. Websites send these capture streams to the other participants. The user obviously wants to see the other participants’ coifs as well, so this is where the WebRTC API kicks in. WebKit finds and creates the optimal network channel to connect those streams.

To handle the networking layer, WebKit chose the LibWebRTC open source framework. LibWebRTC provides both a high level of interoperability and a rich set of streaming features for efficient video conferencing. Safari supports modern audio codecs such as Opus, and with the H.264 video codec takes full advantage of power-efficient hardware.

Currently, Safari supports legacy WebRTC APIs. Web developers can check whether their websites conform to the latest specifications by toggling the STP Experimental Features menu item “Remove Legacy WebRTC API”. Legacy WebRTC APIs will be disabled by default on future releases. Websites that need to accommodate older implementations of the WebRTC and Media Capture specifications can take advantage of polyfill libraries like adapter.js.

There are a lot of ingredients that go into a good WebRTC recipe. To make sure we had what we needed to make video conferencing possible, a few partners joined the party to bring Safari support to their products. Kudos to TokBox and BlueJeans for getting betas available today.

The next generation of communication technologies is here, and we’re really excited to see them in WebKit and on Apple platforms. We want to hear your feedback! File a bug, email, or tweet to @webkit.