So it happened. In addition to the iPhone 8, which is outdated exactly half an hour after the announcement of the iPhone 10, Apple has updated its desktop and mobile browser Safari. Among other improvements is WebRTC implementation (there are rumors that it was partially borrowed from Chromium. “Plan B” also hints at this). What does this mean for developers? You can call through the browser both on the desktop and on iPhones. Voice and video. I already wrote about the updated developer tools in the browser, and now I want to share how it all works in the release. We have already updated the Voximplant SDK, checked how Safari calls Microsoft Edge, and this is what I want to tell ...
The video itself will not play
Apple carefully studied the experience of other browsers before adding support to its own. Along with the support, a lot of restrictions were added, which are designed to protect users from unwanted banners, advertising and other bad things that many sites like so much. One of these restrictions for the iOS version of the browser: the video element, in which WebRTC usually outputs the video stream from the local camera and / or from the second end of the call, will not play the video until the user explicitly allows it.
What does "explicit user permission" look like? This should be an interactive element, in the handler of 'onclick' of which you need to call the 'play' method for the video object. Calling this method from another place of the code or soft pressing the button will not start video playback. I remember that many years ago, Blizzard programmers also fought with bot-drivers in World of Warcraft, making the “protected” API, which could only be called in response to user actions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When two devices agree to establish a connection, they exchange (with your help) SDP text packets. Where, among other things, the supported codecs are listed. h.264 supports the latest versions of Chrome, Firefox and Edge - but in older versions it may not be. Moreover, in addition to browsers, video calls can also come from other SIP-compatible devices: phones, client programs, mobile applications. And if there is no h.264 support there, then there will be no video link.
')
Little things you should know
Chrome and Safari use Plan B to describe media streams in the SDP packet. And Firefox - "Unified Plan". Therefore, if there is more than one media stream (for example, with several video streams of different quality), then someone will have to act as a translator. And about the Edge, I say nothing.
Safari also imposes a number of restrictions on the use of WebRTC: only HTTPS, iframes only from the same domain as the site. And if the first requirement does not cause any problems, then the requirements for iframes severely limits the use of embedded widgets. On the other hand, Apple can also be understood - it is from these widgets that video ads are most often compulsive.