In 2017, Safari announced compatibility with WebRTC. While many things have changed since then, WebRTC technology continues to evolve and move forward. Today, we’ll take a look at the status of a popular feature: screen sharing.
Let’s start by listing the approaches for enabling screen sharing in a web application. Initially, this was possible by using the chooseDesktopMedia API in conjunction with a Chrome extension. This approach worked well, but it was contrary to the no-other-software-required idea and portability of WebRTC because it only worked on Firefox and Chrome. In early 2019, the getDisplayMedia() API was announced, and now it’s possible to screen share without using any plugins!
Let’s explore the current status of both approaches on Safari. To do so, we will use the popular webrtc-experiment site.
Because Safari desktop and mobile are two different beasts, we will test them separately. Let’s start with the desktop version.
Loading the site and enabling screen sharing gives us a light of hope. It seems like it’s working, but we end up the video from the webcam instead of from the screen.
This is expected as this method relies on sending a sourceId to the getUserMedia API, which can only be obtained through an extension when using Chrome. When we move to mobile, we find the same issue. It looks like there’s no use trying to implement this approach in Safari.
Now let’s try the new getDisplayMedia API.
Just like before, we will try Safari desktop first. We open the site and enable screen sharing. It’s working!
Now let’s take a look at Safari mobile.
While Safari desktop made us believe that this could work, we were hit by an incompatibility error on Safari mobile. Let’s take a look at the Mozilla reference.
That confirms it: Safari iOS is not ready for WebRTC screen sharing yet.
While WebRTC compatibility on Safari has come a long way, it struggles to keep up with an ever-evolving technology. Safari is still a good option for simple audio and video use cases, but its lack of consistency between desktop and mobile makes it unsuitable for advanced features. We’ll keep an eye on this and hope to see improvements soon.