UNPKG

rtc-glue

Version:

A simple library for writing WebRTC applications an in HTML-centric way

40 lines (35 loc) 807 B
<html> <head> <!-- configure the signalling to use the test rtc.io public signaller --> <meta name="rtc-signalhost" content="http://rtc.io/switchboard/"> <style> video { max-width: 640px; } video[rtc-capture] { max-width: 240px; float: right; } </style> </head> <body> <!-- video for our local capture --> <video id="main" rtc-capture="camera"></video> <!-- remote container for our frient --> <video rtc-peer rtc-stream="main" muted></video> <!-- make magic happen --> <script src="../dist/glue.js"></script> <script> glue.events.once('connected', function(signaller) { console.log('connected'); signaller.on('color', function(data) { console.log('received color notification: ', data); }); signaller.send('/color', { src: signaller.id, color: 'blue' }); }); </script> </body> </html>