Full WebRTC support is soon coming to a web browser near you!

The web is such an integral part of our lives and how we communicate with each other. That’s why we get so excited when we reach evolutionary peaks that take us leaps and bounds forward in offering a better and open game-changing experience for users and web developers alike! We believe WebRTC to be one of those steps.

What is WebRTC?

The RTC in WebRTC stands for Real-Time Communications, offered directly on the web without any need for plugins or third-party software. The idea is to be able to share and stream video, audio and data in the most powerful fashion, directly in a web browser, offering media rich exchanges.

Representatives from Mozilla, Google, Opera and others have been working on WebRTC over a year, and it is on its way to becoming a W3C recommendation.

The three corner stones in WebRTC are:

MediaStream
Granting web apps/sites access to the camera and microphone on your computer, via the getUserMedia API.
DataChannel
Communicating data peer to peer.
PeerConnection API
Enabling direct peer to peer connections between two web browsers for audio and video.

Code simplicity

If you take a look at our work with WebAPI, you will see examples of a number of simple and intuitive APIs. We believe it’s important for WebRTC to be as easy-to-use by all web developers, not just the rocket scientists among us (nothing wrong with being one, by the way – it’s just that not everyone is. :-))

To enable this, the web browser handles the real-time media and networking for the web developer, so developers can focus on writing apps that include real-time communication as one of the features. We feel the web itself has in part become an incredibly popular tool for so many developers because it makes it easy to create wonderful things to share with the world.

We believe WebRTC will become successful for the same reason.

For example – and you’ve probably already seen this elsewhere – it is very simple to stream the webcam of your computer directly into a web page (with user-granted access, of course):

/*
	NOTE: This is meant to show a simplified version,
	without prefixes and such that are currently used
	for experimental implementations
*/
 
// Get a reference to an existing video element, set to autoplay
var liveVideo = document.querySelector("#live-video");
 
/*  Request access to the webcam
	Note: in current implementations, this has to
	be prefixed, and Google Chrome needs a Blob URL
	for the MediaStream
*/

navigator.getUserMedia(
	{video: true},
	function (stream) {
		liveVideo.src = stream;
	},
	function (error) {
		console.log("An error occurred: " + error);
	}

);

If you want to delve more into the code and APIs right now, then Real-time communication without plugins is a good read.

Coming to a web browser near you!

It is important to note that WebRTC has been planned for a long time, and we are now finally reaching a step where cutting edge web browsers – such as Firefox, Google Chrome and Opera – implement their support and bring WebRTC to the web. With Firefox, our plan is to ship full WebRTC support in Firefox 18, in the beginning of January next year.

Stay tuned, and we’ll keep you up to date on the progress!

About Robert Nyman [Editor emeritus]

Technical Evangelist & Editor of Mozilla Hacks. Gives talks & blogs about HTML5, JavaScript & the Open Web. Robert is a strong believer in HTML5 and the Open Web and has been working since 1999 with Front End development for the web - in Sweden and in New York City. He regularly also blogs at http://robertnyman.com and loves to travel and meet people.

More articles by Robert Nyman [Editor emeritus]…


25 comments

  1. Thijs

    Very exciting! Is there already a beta or alpha Firefox I can test on Ubuntu?

    September 11th, 2012 at 04:35

    1. Robert Nyman

      Thank you, we think so too! No version to test all at this time. However, as outlined in getUserMedia is ready to roll!, that part is ready for testing in Nightly builds of Firefox.

      Eventually everything new will be available in Nightly and then as a next step – probably in a more stable format – in Firefox Aurora.

      If you are interested in the Firefox release channels and running multiple versions at the same time, I recommend reading Firefox and the release channels.

      September 11th, 2012 at 04:48

  2. Daniel Filho

    Amazing, Robert.

    I’m looking forward to create a video-chat for B2G (can’t call it Firefox OS, sorry! haha)

    :)

    September 11th, 2012 at 05:37

    1. Robert Nyman

      It is, I’m really happy this is happening!
      And looking forward to seeing the video chat!

      September 11th, 2012 at 05:51

  3. Arno

    Is there a public test site, where I can test WebRTC conversations with someone else using Firefox Nightly?

    September 11th, 2012 at 07:27

    1. Robert Nyman

      Not really in such a state that I’d recommend it for the moment. We’ll keep you updated here, though, and have more interesting posts as we progress!

      September 11th, 2012 at 09:48

  4. Shmerl

    Does it mean that XMPP/Jingle stack will be possible to implement in pure JavaScript?

    September 11th, 2012 at 11:54

  5. Randell Jesup

    Since JSEP provides the JS app with the SDP needed for the connection, the app can implement any protocol it likes in JS to get that to the other party. (Security concerns limit the JS to normally access only the server it was loaded from, note.)

    People have done SIP-in-JS, so likely you *could* do XMPP/Jingle in JS. I wouldn’t say it would be easy, though with enscriptem one could cross-compile C++ code to JS as a backdoor way to do it.

    September 11th, 2012 at 12:08

    1. Shmerl

      Without such kind of implementation, the benefits of WebRTC would be limited to some custom / non interoperable web to web use cases. Having a full blown XMPP/Jingle implementation would allow communicating with any compliant client, so I hope Google or someone are going to work on it (since Google are one of the major XMPP/Jingle backers).

      September 11th, 2012 at 12:17

  6. rjesup

    I’ll note that XMPP/Jingle doesn’t solve your problems, as a number of other things are needed for a direct connection (with appropriate security guarantees). So you can transform signaling into XMPP/Jingle, but you’re likely to still need a media gateway.

    I’ll also note a primary user/author of jingle is Google’s lead on webrtc, Justin Uberti, and he’s also a primary designer (along with Cullen Jennings) of the JSEP protocol used by WebRTC.

    You might want to ask about specific usecases and the best way to handle them on the discuss-webrtc mailing list.

    September 11th, 2012 at 13:05

    1. Shmerl

      I see thanks. XMPP handles initial communication through the XMPP servers naturally, but Jingle itself should in the end should work as direct P2P RTP stream (after the connection is established). So naturally I’m talking about users who are communicating using their JIDs, and logging into their XMPP accounts first.

      September 11th, 2012 at 13:28

    2. Shmerl

      Security should be handled with something like OTR and ZRTP, but that’s a whole area in its own.

      September 11th, 2012 at 13:30

  7. Peter Moskovits

    There are WebSocket solutions out there that support XMPP out of the box. For example, Kaazing (the company I work for) offers an XMPP edition of its WebSocket gateway, offering JavaScript (and Java and .NET and Flash) XMPP APIs: http://kaazing.com/products/xmpp-edition.
    Here’s a screen cast of a live demo: https://vimeo.com/49419793. The demo is hosted at http://demo.kaazing.com/livefeed/.

    September 13th, 2012 at 16:09

  8. Randell Jesup

    ” but Jingle itself should in the end should work as direct P2P RTP stream (after the connection is established)”

    I’ll note that WebRTC will not talk plain RTP for various security reasons, so to talk to any legacy plain-RTP device it will need to go through a gateway. Right now, Chrome is supporting SDES-SRTP (which may be compatible with XMPP), but the spec only mandates DTLS-SRTP, and that’s all Mozilla is expecting to support (again, for security reasons – SDES leaves you at the mercy of all servers with access to your SDP). Chrome will support DTLS-SRTP; they might remove SDES-SRTP – I don’t know.

    Also, the target must support full ICE (not the subset of ICE used in GTalk/etc), which may again require a gateway.

    September 14th, 2012 at 02:44

    1. Shmerl

      So in the end it means that without a gateway one won’t be able to build an XMPP/Jingle client with JavaScript only (i.e. replacing something like Google Talk native plugin with JavaScript code)? Doesn’t it defeat the purpose? Many XMPP servers already exist, but not all of them have extra gateways.

      Or it means that XMPP should come up with something new instead of Jingle to be able to benefit from WebRTC directly?

      September 19th, 2012 at 09:05

      1. Randell Jesup

        WebRTC likely can’t be implemented with pure JS in a server – too many wireline protocols, like ICE, are needed (with tight timing requirements in ICE).

        Also, I think you’re saying you want to build a XMPP/Jingle client *in the browser*, is that correct? WebRTC isn’t designed to do that; it’s not a generic “access network streams” protocol – the security implications of that would be dire.

        Something at the server must: do ICE, handle DTLS-SRTP streams, and handle some RTP RFCs we require. Others are optional but would be nice (bundle, rtcp-mux, etc). The JS code can take the SDP and transform it into XMPP/jingle and send it via https/websocket/etc to the server (which it loaded the JS code from! (Or equivalent via CORS)), or it can send the JSEP to the server and let the server process (or transform it to XMPP and forward it).

        September 19th, 2012 at 09:36

        1. Shmerl

          I see, so in order for all those to function, XMPP servers will need to be extended specifically to cater for WebRTC specifically (like for example ejabberd already has BOSH and Websockets extensions to cater for web based XMPP clients). I hope all this will move in that direction eventually.

          September 20th, 2012 at 15:44

  9. Saraj

    Will this supported for Mobile platforms – Android and iOS as well?

    September 14th, 2012 at 16:14

    1. Robert Nyman

      I can only answer for Firefox on Android, where it’s planned to come in the future (not just at the exact same time).

      For other web browsers on Android, iOS and other mobile operating systems, I hope they will get it soon too.

      September 17th, 2012 at 02:00

  10. Jim

    Does Mozilla have any plans to offer instant messaging and WebRTC services? I don’t imagine the bandwidth needed would be prohibitive. Since there will need to be user account management for Mozilla Marketplace anyway, also offering XMPP instant messaging and WebRTC for those accounts would be useful for both Thunderbird and Firefox.

    September 18th, 2012 at 21:26

    1. Robert Nyman

      To my knowledge, not at this time. In general, we want to offer implementations and APIs for people to build whatever they want, not services.

      That said, implementing user accounts could be done through Mozilla Persona and things might change down the line with what we offer.

      September 19th, 2012 at 03:50

  11. Hayk

    Can’t wait to see webrtc on mobile

    September 20th, 2012 at 21:57

    1. Robert Nyman

      I feel the same way!

      September 21st, 2012 at 01:13

  12. Anuj

    Hello Robert. This thing has been bugging me a lot. Is there any way to stream recorded Video files like .ogg or .webm via webRTC? I plan to make a video streaming web application and don’t know where to start from. I hope webRTC is the answer.

    October 28th, 2012 at 21:54

    1. Robert Nyman

      Good question. I hope that will become available later on.

      October 30th, 2012 at 04:49

Comments are closed for this article.