Skip to content

Instantly share code, notes, and snippets.

@aBuder
Created April 2, 2014 12:43
Show Gist options
  • Save aBuder/9933328 to your computer and use it in GitHub Desktop.
Save aBuder/9933328 to your computer and use it in GitHub Desktop.
SimplewebRTC has no method 'sendDirectlyToAll'
$(document).ready(
function (){
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: 'remoteVideos',
// immediately ask for camera access
autoRequestMedia: true,
debug: true,
media: {
video: false,
audio: true
}
});
// we have to wait until it's ready
webrtc.on('readyToCall', function () {
// set the room
webrtc.joinRoom('testRoom');
webrtc.sendDirectlyToAll('testRoom','setDisplayName', 'Alexander Buder');
webrtc.on('channelMessage', function (peer, label, data) {
if (data.type == 'setDisplayName') {
var name = data.payload;
console.log('Received displayName ' + name + ' from peer ' + peer.id);
}
});
});
});
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<meta charset="utf-8">
<title>SimplewebRTC Test App</title>
<!-- Please set your link to app -->
<script src="https://raw.githubusercontent.com/HenrikJoreteg/SimpleWebRTC/master/simplewebrtc.bundle.js"></script>
</head>
<body>
<video id="localVideo"></video>
<div id="remoteVideos"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment