Badass JavaScript

A showcase of awesome JavaScript that pushes the boundaries of what's possible on the web, by @devongovett.

Holla: A Sugary API Abstraction for WebRTC Voice and Video Calling in the Browser

February 19th 2013

I posted about PeerJS recently, which is a nice API on top of WebRTC for peer-to-peer networking of arbitrary data.  However, one of the main selling points for WebRTC is its voice and video calling support.  Holla is a JavaScript library that aims to make working with WebRTC’s voice and video calling APIs much easier.  WebRTCs APIs are pretty low level and not something everyone wants to deal with directly, so a nice API abstraction is very much welcome.

Like PeerJS, Holla has both a client and a Node.js server component.  The server helps broker the peer-to-peer calls between clients with usernames.  Once usernames are registered, the clients can make voice or video call requests as well as send chat messages to other client usernames.  On the other end, the second client can either answer or decline the call, and then send the video stream to a <video> element to be displayed.  The API looks really simple to use, and thanks to WebRTC will make pretty much anyone able to build their own Skype in a couple minutes.

The demo allows you to declare your username and then call and chat with other usernames, and shows the power of the API to do a lot with a very small amount of code.  It’s a simple demo, and it only works in Chrome and Firefox Aurora so far, I think, but I’m looking forward to future widespread adoption of WebRTC.  You can see the code for the demo on Github to get a feel for the niceness of the API, and then look at the rest of the code for the client and server to see what it’s doing for you.

WebRTC is the way of the future and it’s good to see adoption and 3rd party library abstractions already being created.  As always, you can find the code for the library and its demo on Github.