Monday 24 June 2013

WebRTC - The HTML5 late arrival

So, with my WebRTC  coursework graded and returned (A20 should do nicely) I'm in a good place to discuss more, this blog post will seek to cover the theoretical side of WebRTC. Whos? Whats? Whys? And what fors? I plan to cover the gaming aspects and technical implementation of WebRTC in later posts.

What is WebRTC?

The Web Realtime Communications Project (WebRTC) is a World Wide Web Consortium (W3C) Draft Specification, similar to HTML5 which is still only a candidate recommendation. WebRTC, however, is in a much earlier stage, currently seeking a proof-of-concept. The project is being actively developed by the web community, key supporters are the Google Chrome team and Mozilla Foundation. It is currently partially supported in Chrome's stable branch and Mozilla Firefox's nightly edition.

WebRTC's main purpose is to create a framework for pure browser based real time communication, primarily video and audio chat but with other potential uses. To achieve this aim it has a variety of functions relating to acquiring webcam and microphone feeds and streaming these over a peer-to-peer (P2P) connection under varying network conditions.

Acquiring Local Audio/Video Streams

The first section of the WebRTC project relates to acquiring streams from the browser for local playback and streaming. This is done by making a request to the browser including a set of constraints such as the maximum dimensions of the video stream and whether or not to include audio. This gives the Web Application Developer a lot of scope in how they want to use these feeds. The feeds are returned as blobs but can also be retrieved in Data URI form allowing them to be passed into the src attribute of a video tag. Of course, from there the video tag can be rendered into a canvas for games purposes, which I'll discuss slightly later. At the time of writing you can acquire these feeds in Chrome's stable edition with the -webkit- prefix and Firefox's nightly edition with -moz- prefix.

P2P Data Connections and Streaming

Peer-to-peer connections with WebRTC come in two flavours, RTCPeerConnection and RTCDataChannel. Both create a P2P connection with another client, the connection is established via an intermediary server however the server is not used after this initial stage. The difference however is that the RTCPeerConnection is designed purely for streaming audio/video and includes several features specifically for this. There are outlined in the architecture diagram below but include Packet Loss Concealment, dynamic jitter buffering, noise reduction and echo cancellation.

RTCDataChannel's on the other hand, are more basic, designed purely for steaming data over a P2P connection however the inbuilt security and ability to use both reliable and unreliable (TCP & UDP) connections means it could be extremely useful in games situations. At the moment however, RTCPeerConnections work in Chrome Stable with a -webkit- prefix and Firefox nightly with a -moz- prefix.

So that's WebRTC, a quick introduction, keep an eye for updates regarding gaming in WebRTC and perhaps a quick look at how to actually implement it. Any questions chuck them in the comments - oh yeah and feel free to check out the application that informed this post.

Not long after posting full WebRTC support was announced for both Chrome and Firefox! Good Times!

No comments :

Post a Comment