
Apple Announces Full WebRTC Support in Safari 11 - shacharz
https://blog.peer5.com/apple-announces-support-for-webrtc-in-safari-11/
======
om2
WebRTC was the #1 most requested web platform feature for Safari. Now coming
to macOS and iOS: [https://webkit.org/blog/7726/announcing-webrtc-and-media-
cap...](https://webkit.org/blog/7726/announcing-webrtc-and-media-capture/)

You can even try it out now on Safari Technology Preview:
[https://webkit.org/blog/7627/safari-technology-
preview-32/](https://webkit.org/blog/7627/safari-technology-preview-32/)

~~~
russelldc
I can't get many WebRTC projects/test pages to actually work on the new Safari
preview. Is there anywhere they list the specific features implemented from
the spec?

~~~
shacharz
Try running [https://test.webrtc.org/](https://test.webrtc.org/)

~~~
om2
Unfortunately this test page uses legacy APIs that have been removed from the
spec years ago, so it can't give an accurate assessment.

------
sherbondy
SO excited about this. Data-channel and all. Non-jailbroken torrenting on iOS
at long last :P [https://webtorrent.io/](https://webtorrent.io/)

Also, definitely worth trying out this AR.js demo if you're running the beta:
[https://freinbichler.me/apps/web-ar/](https://freinbichler.me/apps/web-ar/)

Always thought it was a little peculiar that the Media Capture APIs are tied
to what is otherwise a very data/protocol-oriented spec.

Wish we could have had a camera feed in a canvas element on Mobile Safari a
few years ago without having to wait for the entirety of WebRTC to be vetted.
:P

\---

And now, for my own unrelated Web API peeve:

Beyond service workers and all that jazz, I'm a little bummed out that the
Pointer Events API isn't even _listed_ on the Webkit Feature Status page:
[https://webkit.org/status/](https://webkit.org/status/)

It just seems like such a pleasant unification of all of the input-type APIs
(mouse, touch, pen, hypothetical future peripherals...)

At least touch events have a "force" property with Apple Pencil input in the
meantime. No tilt though.

Maybe next year :/

~~~
spike021
How would this allow you to torrent on iOS without jailbreaking the device?

My phone, though an iPhone 6, seems to shut down Safari if I've been using
other apps long enough. I can't imagine it staying alive long enough to
torrent anything large.

~~~
IMcD23
Keep Safari active. You can use other apps in split screen while the file
downloads.

~~~
MBCook
No split screen on the phones (unless perhaps the plus size allows it, but I
don't think so).

------
ArlenBales
What WebRTC apps can we expect will be mainstream in, say, 6 years? I'm just
trying to picture what this technology will allow (or replace).

~~~
shacharz
That's the $1B question. The obvious application is the video conferencing
style hangouts, Skype (which are using WebRTC already). The nice thing about
having video conf capabilities in the browser is that you can embed it in any
web page and start do interesting things with it - like interactive lectures.
Improved gaming networking is another vertical. We've built Peer5 (W17) on top
of WebRTC to create a P2P CDN for Video streaming

~~~
ArlenBales
What about a WebRTC version of Twitch.tv? Is that feasible in 5 or 10 years?
Twitch does transcoding and I'm not sure how transcoding would work with
WebRTC.

~~~
Nullabillity
It would probably be possible for smaller communities today, given how cheap
bandwidth already is. For comparison, I'm currently paying ~$13/mo for a
(symmetric) gigabit connection.

The main reasons for transcoding are downstream bandwidth usage and codec
support. WebRTC mandates VP8, so codecs shouldn't be an issue. Downstream
bandwidth usage probably wouldn't be a major concern when it's viable to
stream at 1080p to thousands of viewers from a home connection (though I doubt
that's going to happen soon). So you could probably ignore transcoding
entirely.

However, marketing would probably be an issue, since this architecture would
prevent streamers from having more than about a hundred watchers, meaning that
the big fish would stick to Twitch. That said, I suppose you could have a
failover system, where larger streamers would switch to a relay-based system.

~~~
Gaelan
Where do you live? Internet is _way_ more expensive in the US.

~~~
Nullabillity
Stockholm.

~~~
MBCook
If you're lucky enough to have Google Fiber in the US it's $70/mo for
symmetric gig, IIRC.

------
dested
Wow, this has been a long time coming. So many shoddy video communication
hacks can finally go away. This is huge.

------
jameslevy
Should we assume mobile safari will also get WebRTC support, or is that a lot
less likely to happen in the near future?

~~~
om2
It's coming to both macOS and iOS in Safari 11 and iOS 11.

~~~
shacharz
Can you share a link please?

~~~
om2
Here's the announcement on the WebKit blog:
[https://webkit.org/blog/7726/announcing-webrtc-and-media-
cap...](https://webkit.org/blog/7726/announcing-webrtc-and-media-capture/)

------
EGreg
Does this mean Apple may actually implement Service Workers and Web Push in
the next Safari?? :)

~~~
threeseed
I hope not as Service Workers is an awful technology.

It is completely hostile to users. If I close a web page I expect everything
related to that web page to stop. Immediately. I don't expect there to be
lingering background threads consuming battery life, network data and disk
storage. And in Chrome you can only discover service workers by enabling a
Debug mode and memorising a specific URL. Exactly how does a non-developer
figure out what is going on ?

If Apple had any sense they would ban service workers and instead propose use
case specific, tightly focused and managed APIs that focus on security and
battery life first.

Also just a hint at a future where Botnets are running in your browser:

[https://sakurity.com/blog/2016/12/10/serviceworker_botnet.ht...](https://sakurity.com/blog/2016/12/10/serviceworker_botnet.html)

~~~
EGreg
Service workers were designed to only work during events which you opted into.
Either because you loaded the site which is now making requests, or because
you OPTED IN to receive notifications.

Think about it this way... why do you have to download an entire app just to
use a site? Don't like the notifications? Turn the off.

~~~
threeseed
Yes because ordinary users never, ever opt in to things they shouldn't. And
because of that one opt-in mistake suddenly they have invisible service
workers mining Bitcoins which they could never learn about since the discovery
mechanism for service workers is currently non-existent.

Again, the concept of background tasks isn't necessarily a bad thing. But it
needs to be locked down to specific use cases not a free for all allowing
arbitrary JS to be executed.

~~~
MichaelGG
So limit the amount of CPU/bw/etc. they can use, just like mobile platforms do
for background apps?

~~~
ghughes
Installing an app is a higher bar than tapping the "get out of my way" button
on a modal dialog that some website just shoved in your face.

------
gk3
ive dreamt of this for years!!! so excited.

quick question: i noticed that the camera isnt available on iOS 11 if you put
a web-app capable page on to your homescreen. when you open the page in full
screen, mediaDevices is undefined. is that just an iOS beta bug?

~~~
voltrevo
It’s not a bug. Spoke to an Apple engineer about this today at WWDC. There’s
security concerns enabling media devices for webviews outside safari, but it
should be coming ‘soon’.

~~~
gk3
Noooooooo

~~~
voltrevo
Yeah... I’d file a bug anyway though, might help them prioritise it.

------
shmerl
So now they'll start supporting Opus at last, or they'll find another excuse
not to support free codecs? Once they'll support it, AAC can be thrown out in
the garbage.

And when are they going to support MSE[1] in iOS Safari?

1\.
[https://en.wikipedia.org/wiki/Media_Source_Extensions](https://en.wikipedia.org/wiki/Media_Source_Extensions)

------
cptskippy
Anyone else feel like Apple is the new Microsoft and they hold the world
hostage by only updating their products every couple years with features we
actually want? It seems like just as the unrest is about to hit critical mass
they spring into action and implement just enough to placate everyone for
another couple years.

------
lern_too_spel
We're not out of the woods yet: [https://thenewdialtone.com/hold-apple-webrtc-
ios-party/](https://thenewdialtone.com/hold-apple-webrtc-ios-party/)

~~~
TD-Linux
Plan B is pretty disappointing, Chrome compatibility winning over standards
compliance :(

------
TheAceOfHearts
I'll take a quick moment to share my favorite web app which uses WebRTC:
Instant.io [0]. I use it all the time to transfer files among local devices,
or to send medium to large files to friends.

[0] [https://instant.io](https://instant.io)

------
zurn
It would be interesting to see surveys about mobile IPv6, will it get along
with P2P? Will mobile users get P2P video this way or have the operators
crippled end-to-end connectivity?

------
taf2
TypeError: nativeMediaDevices.addEventListener is not a function

still some bugs maybe...

~~~
kosinus
This is a capturing API, I guess?

Using webrtc-adapter, all of my webrtc code instantly worked. Though it
doesn't seem to want to connect to firefox peers.

------
angry_octet
So, any one know how one might block WebRTC in Safari?

------
kobayashi
Can it be disabled? (VPN privacy, and all...)

------
ap46
YASSS!!! FINALLY!

------
brian_herman
Yayaya!

------
bla2
Still only supports proprietary codecs from what I understand. So not "full".

~~~
TD-Linux
It does support Opus for audio! No VP8 yet, but halfway there.

------
hannob
I saw this yesterday on twitter and my thought was "they don't support webrtc
yet?!? seriously?"

It sometimes baffles me how apple is holding up progress on the web - and that
they aren't criticized more for it.

~~~
abalone
They're not holding up progress. They have different objectives, and chief
among them is power efficiency. Chrome eats up a lot more battery life than
Safari.[1] So did Flash (among other conflicts), and I think we all accept now
that "holding that up" was good for the web in the long run.

Apple tends to take a little longer and suffer a little short-term pain to get
it right in the long run.

[1]
[https://daringfireball.net/2017/05/safari_vs_chrome_on_the_m...](https://daringfireball.net/2017/05/safari_vs_chrome_on_the_mac)

~~~
o_____________o
Apple has absolutely kneecapped web technologies. Mobile Safari has simple,
egregious bugs that have been open for years. We're talking about things like
being able to crash the browser with CSS or file selection, etc. It's
impossible to make the case that Apple is just rejecting features for the sake
of the user. The next question is why, and you'll need some creativity to come
up with any other answer than pointing to the monolithic, money printing app
store.

~~~
callalex
Any input that can crash the browser is a potential security vulnerability.
Can you point me to an example of an inpatched crash in Safari that has been
"open for years"?

~~~
om2
We'd super appreciate bug reports of reproducible crashes and we definitely
try to look at them. Bugs welcome at
[http://bugs.webkit.org/](http://bugs.webkit.org/)

------
microcolonel
Apple and Microsoft waited five years to deploy this thing. Given how quickly
it was implemented and adopted by other browsers, I have to wonder what their
motives were for deliberately not integrating it; because frankly they
could've done it pretty quickly at any point in the last five years.

I remember having to integrate WebRTC through cordova (thank goodness somebody
did it first) a couple years ago, and wondering why on earth Apple didn't find
time or money for this. libwebrtc has been stable for years, it represents
effectively no security risk, it performs well on all of their platforms. It
truly boggles the mind.

~~~
om2
WebRTC is actually quite complicated to implement and it took a large effort
by a big chunk of the WebKit team, even though we had a lot of code that we
could reuse. People have a lot of theories about Safari deliberately omitting
one feature or another, but the truth is there's only so much we can do at
once.

ETA: If you look at the page counts of all the required specs (ECMAScript
APIs, WebRTC protocol specs, underlying codec and protocol specs like Opus and
RTC) it adds up to multiple thousands of pages. By comparison, the whole HTML5
spec (current WHATWG version) is 855 pages.

~~~
microcolonel
I understand, though when it comes to WebRTC, there is an existing, efficient,
stable implementation in a license which is compatible with WebKit and Apple's
proprietary embeddings of it. You aren't going to be translating the WebRTC
protocol diagrams and interfaces yourself. The main effort would be elsewhere
(adapting it to Apple's platform TLS libraries perhaps, verifying the
bindings, fitting it into the compositor, sandbox, etc.).

I would think the greatest barrier to integrating Opus would be getting Apple
legal to agree not to sue other Opus adopters . Fair enough, but that's not
five years worth of legal research. I would be gobsmacked if Apple bothered to
write their own encoder or decoder just for WebKit, you don't need to read the
bitstream format documentation.

And again, Apple has so much cash on hand that it takes the accountants five
minutes to walk across a line on their balance sheets. Maybe the rest of you
are busy, fine, but there are people who are qualified to put WebRTC in WebKit
in the general public. Apple could send some money to the qualified people at
Collabora, Igalia, or Ericsson Research (who I think have had WebRTC in Webkit
since 2015).

All in all, it's absolutely bogus that Safari hasn't had WebRTC for at least
two years already. You can make all the excuses you want, but this API drives
more customer value than _any ES6 feature_. Nobody actually deploys ES6 on the
web today, because it has forced browser vendors to completely reengineer
their compilers, taking half a decade each, and as a result it has not been
deployed long enough with decent performance to offer any value. WebRTC has
been deployed for going on five years in valuable applications which are
_otherwise completely impossible on the web_ , half the other crap has no
userbase, and offers questionable tangible value.

~~~
alwillis
_I understand, though when it comes to WebRTC, there is an existing,
efficient, stable implementation in a license which is compatible with WebKit
and Apple 's proprietary embeddings of it._

Just like with all of the other web standards, I'm pretty sure the WebRTC code
is in the publicly available repo.

Obviously Apple isn't afraid to collaborate with other entities--Igalia did
the CSS Grid implementation that ships in Safari and WebKit.

