LWN.net Logo

Development

Firefox and Chrome talking with WebRTC

By Nathan Willis
February 20, 2013

On February 4, the Mozilla Firefox and Google Chrome teams demonstrated their interoperability by conducting a live video chat between the two offices. This is possible because Firefox and Chrome have both implemented support for WebRTC, the real-time multimedia communication framework being developed by both projects, in conjunction with the World Wide Web Consortium (W3C) and Internet Engineering Task Force (IETF). WebRTC's JavaScript API will allow web developers to write audio/video chat applications that function without extensions or plugins—and, in theory, with reliable interoperability between browser implementations.

Mozilla documented the test call on its Mozilla Hacks blog, and the Google team did the same on the Chromium blog. A recording of the test call is viewable in both posts as a YouTube video. It lasts about a minute, and although it looks simple enough, as Mozilla Chief Innovation Officer Todd Simpson explains, there are quite a few important details under the surface. The call used the royalty-free VP8 and Opus codecs for video and audio, respectively, used Interactive Connectivity Establishment (ICE), Session Traversal Utilities for NAT (STUN), and Traversal Using Relays around NAT (TURN) for firewall traversal, and was encrypted with Secure Real-time Transport Protocol (SRTP) and Datagram Transport Layer Security (DTLS). ICE is a higher-level NAT-traversal protocol that makes use of STUN and TURN to select from among several possible connection methods; DTLS is a datagram-oriented secure transport layer that uses SRTP for key exchange. The actual media streams are sent over a WebRTC PeerConnection.

The application used in the demo call is AppRTC, which runs on Google's App Engine service. Interested parties can test it out for themselves, but will need to use either a recent nightly build of Firefox (the Desktop edition only, for now) or a Chrome 25 beta in order to utilize the chat. For curious developers, AppRTC's source code is available for inspection; the cross-browser interoperability is made possible by a short JavaScript adapter that smooths over the differences between Firefox's and Chrome's function names: Firefox prefixes its interfaces with moz and Chrome with webkit (note that, at the moment, Chrome appears to be the only WebKit-based browser with a WebRTC implementation). Such prefixing behavior is a familiar sight to web developers, although the WebRTC interoperability page says both browsers will drop the prefixes when the specification gets "more finalized." According to that page, there are a few other syntactic differences between the browsers' implementations, as well as differences in STUN support and SRTP connection negotiation. The Mozilla blog entry also includes code snippets from another sample application, which appears to be a Firefox-only affair.

Beyond words

Live video chatting is nice, and for Linux users in particular, having the functionality "baked in" to two of the most popular cross-platform browsers is a far sight more appealing than installing binary plugins. But WebRTC's functionality offers more than just conversation. The getUserMedia API used to access video and audio data through webcam hardware can be used in other classes of applications. Mozilla has a tutorial implementing simple photo-booth functionality, for example, and Marko Dugonjić recently speculated that it could be used to implement proximity detection.

WebRTC also specifies a general-purpose DataChannel API in addition to the PeerConnection media stream. Clients can use any underlying data transport protocol they choose; WebRTC only specifies that they agree on its setup, teardown, and reliability. Mozilla is the first browser vendor to implement DataChannels for WebRTC; back in November 2012, Simpson demonstrated Firefox using DataChannels to share content over Firefox's Social API, including live text chat and peer-to-peer file transfer.

The codec wars

The ability to use WebRTC with royalty-free codecs like Opus and VP8 can also be seen as a partial vindication of Mozilla's 2012 decision to implement OS-fallback support for the patent-encumbered H.264 codec. The decision enabled playback of H.264 content by passing the necessary decoding duties down to the operating system—including, particularly on mobile clients, hardware video decoders. Prior to that decision, Mozilla had argued that it would not support H.264 because doing so would require it to pay royalties to H.264's patent holders. Mozilla instead fought for the adoption of the royalty-free Theora and VP8 codecs, including arguing for the inclusion of such a free codec as a requirement in the HTML5 <video> element.

When it announced in March 2012 that it would implement a fallback mechanism for H.264 playback, Mozilla justified the decision by saying it needed to focus its resources on emerging media standards, rather than by continuing to fight against an entrenched one. Brendan Eich cited WebRTC as the next major battlefield. The battle appears to be going in favor of unencumbered codecs, as the IETF draft specification requires Opus, but it is clearly still not over. The corresponding draft that addresses video requirements mentions VP8, but it requires neither VP8 nor any other specific codec.

No doubt proponents of H.264—particularly those who stand to reap royalty payments—will continue to lobby in favor of H.264. But the playing field is different; unlike the <video> element, consumer video cameras (many of which record to H.264 directly via hardware encoders) do not factor into the basic WebRTC use case. And, just as importantly, the development of WebRTC is spearheaded by two free software browser projects. That gives what-the-browsermakers-want an intrinsic head start against competing codecs. The fact that users can download and use VP8-powered WebRTC for free, real-time video chats today gives the royalty-free an even bigger advantage: the sole working implementation.

Comments (1 posted)

Brief items

Quotes of the week

Want to visit an incomplete version of our website where you can't zoom? Download our app!
Randall Munroe

Sometimes it looks like an IDE, sometimes it looks like an operating system, sometimes it just looks like an editor. If you simply must feel like you’re using an IDE, fire up Eclipse; then there’ll be no doubt. Just don’t blame me if you still aren’t happy.
Jon Snader, addressing the question "Is Emacs an IDE?"

Comments (3 posted)

Opera moves to WebKit and V8

Opera has announced that it will stop using its own rendering engine and will migrate its browser to WebKit and the V8 JavaScript engine—specifically, the Chromium flavor of WebKit. Opera Mobile will be ported first, with the desktop edition to follow later. The announcement downplays the significance of the change, saying: "Of course, a browser is much more than just a renderer and a JS engine, so this is primarily an "under the hood" change. Consumers will initially notice better site compatibility, especially with mobile-facing sites - many of which have only been tested in WebKit browsers."

Comments (92 posted)

Liberated Pixel Cup winning games announced

Liberated Pixel Cup, the free software game-design contest, has finally revealed the winning entries. The overall grand prize went to "Lurking Patrol Comrades," with additional nods going to "Big Island," "Castle Defense," and "Laurelia's Polymorphable Citizens." In addition to the wrap-up, the announcement addressed the potential for more LPC-style contests in the future: "Despite the judging delay, one other sign of success is how excited many of the participants of this year's Liberated Pixel Cup have been to find out if there would be another one. The answer is simply: we aren't sure, but we are certainly interested in it."

Comments (1 posted)

Samba developers considering removing SWAT

The developers in the Samba Team are considering removing the SWAT administration tool due to the series of security problems related to it. "The issue isn't that we can't write secure code, but that writing secure Web code where we can't trust the authenticated actions of our user's browser is a very different model to writing secure system code. Frankly it just isn't our area." Unless somebody steps up to maintain this tool properly, it may well be on its way out.

Full Story (comments: 15)

Texinfo 5.0 available

Karl Berry has released version 5.0 of Texinfo, the GNU documentation format. This is the first new release in for years. "By far the biggest change is a complete reimplementation of makeinfo. It is now much more flexible but also, sadly, much slower, despite all our optimization efforts. We hope all the many improvements make the new version worthwhile for users nevertheless."

Full Story (comments: none)

TinyCC: 0.9.26 available

A new version of TinyCC, the tiny C compiler, has been released after a three-year development cycle. Changes include many improvements for ARM, multi-arch configuration, and out-of-tree builds.

Full Story (comments: none)

Firefox 19 available

Firefox 19 is available, for Linux and other platforms. According to the release notes, notable changes include the built-in PDF renderer and several changes to the Web Console and debugging tools.

Full Story (comments: none)

Newsletters and articles

Development newsletters from the past week

Comments (none posted)

Two years of Guile 2.0

February 16 marked two years of Guile 2.x, and in celebration the project held a "potluck"-style hackfest. The entries include portable Scheme bindings to Memcached, a distributed computation system based on ZeroMQ, and a "boot to Guile" image for QEMU. "The image boots a Linux-Libre kernel with an initrd containing a copy of Guile, and where the +/init+ file is a Scheme program. The image's build process is fully automated with GNU Guix. This is a preview of what the Guix-based GNU distribution will soon use."

Full Story (comments: none)

GCC 4.8.0 Status Report (2013-02-14)

Joseph S. Myers has published another update on the progress of GCC 4.8.0. Stabilization work continues, and "GCC trunk is likely to be ready some time in March for a 4.8 release branch to be created and a first release candidate made from that branch."

Full Story (comments: none)

GIMP team revitalizes astrophotography tools (Libre Graphics World)

Libre Graphics World takes a look at recent GIMP developments that refresh the application's capabilities for working with astrophotography. High bit-depth support is a major factor, but so is supporting the Flexible Image Transport System (FITS) data format and implementing key image processing algorithms. "Further work here is likely to involve porting the plugins to GEGL, so that tools like the rounding of stars and layers alignment would work directly on GEGL buffers."

Comments (none posted)

Page editor: Nathan Willis
Next page: Announcements>>

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds