Fork me on Github

simpleWebRTC

You can build cool stuff with WebRTC in five minutes.

Want to see what this library can do? Talky.io is powered by SimpleWebRTC!

Or checkout the demo (note that screensharing won't work because HTTPS is required.)

A dab of HTML

<!DOCTYPE html>
<html>
    <head>
        <script src="http://simplewebrtc.com/latest.js"></script> 
    </head>
    <body>
        <video height="300" id="localVideo"></video>
        <div id="remotesVideos"></div>
    </body>
</html>

Stir in the WebRTC object

var webrtc = new SimpleWebRTC({
  // the id/element dom element that will hold "our" video
  localVideoEl: 'localVideo',
  // the id/element dom element that will hold remote videos
  remoteVideosEl: 'remotesVideos',
  // immediately ask for camera access
  autoRequestMedia: true
});

And join when ready

// we have to wait until it's ready
webrtc.on('readyToCall', function () {
  // you can name it anything
  webrtc.joinRoom('your awesome room name');
});

Need More Control?

In order to make WebRTC as approachable as possible, SimpleWebRTC assumes a lot about the type of app you want to build.

It's unlikely that if you're going to ship an app that uses WebRTC SimpleWebRTC will have the exact features you want. Likely you'll want to use bits and pieces of it. Well, you're in luck! SimpleWebRTC is actually comprised of a whole bunch of independent little modules to help you:

More Info

For news/updates follow @HenrikJoreteg, @andyet, and @usetalky.

Also, don't forget to try Talky for zero-setup meetings powered by WebRTC.

Henrik's also written a book about modern clientside apps to help you build a well-structured, maintainable app to contain your WebRTC experience. The approaches it describes were used to build Talky, And Bang, and many similar apps. Check out the book: Human JavaScript.

Signaling server

SimpleWebRTC uses the SimpleWebRTC.com sandbox server and is only for development and testing purposes. This server does not provide media relay facilities so there might be connectivity issues.

The signaling server is open source (MIT) licensed as well. You can find it here: github.com/andyet/signalmaster.

STUN and TURN server

STUN and TURN servers are required to help establish the connection between clients. STUN helps clients to determine their public IP and TURN provides media relay.

For talky.io, we use a modified version of the restund available from github.com/andyet/otalk-server/restund/ that works great in combination with signalmaster. Alternatively, you can use rfc-5766-turn-server.

If you don't want to run your own TURN server, checkout XirSys who provide hosting and a tutorial on integrating simplewebrtc with their API.

Need Help?

Join the SimpleWebRTC discussion list if you have questions.

Have a look around in the issues to see if your question has been answered.

Also, at &yet we offer WebRTC consulting to help you build awesome apps with WebRTC.