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.
25 comments