Skip to content

Instantly share code, notes, and snippets.

@tomlagier
Created February 9, 2015 19:13
Show Gist options
  • Save tomlagier/8de8991affed20cb67c2 to your computer and use it in GitHub Desktop.
Save tomlagier/8de8991affed20cb67c2 to your computer and use it in GitHub Desktop.
/* globals SignallerPeerConnection */
$(function () {
'use strict';
var spc = new SignallerPeerConnection();
spc.on('localStreamAdded', function (stream) {
var local = document.getElementById('local');
local.src = URL.createObjectURL(stream);
});
spc.on('remoteStreamAdded', function (stream) {
var remote = document.getElementById('remote');
remote.src = URL.createObjectURL(stream);
});
spc.on('localStreamRemoved', function () {
var local = document.getElementById('local');
local.src = '';
});
spc.on('remoteStreamRemoved', function () {
var remote = document.getElementById('remote');
remote.src = '';
});
$('#show').on('click', function () {
spc.addLocalStream();
});
$('#hide').on('click', function () {
spc.removeLocalStream();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment