Unable to Make Call

281 views
Skip to first unread message

Kyle Baker

unread,
May 22, 2016, 12:26:41 PM5/22/16
to PeerJS
I can successfully make a connection using the connection method which I can prove by this peer.on('connection', function() {console.log('connection received!')}) however, if I try the same thing with call, namely on('call'), there is no log message. I am passing in a valid id and media stream when invoking the call method on the other side. I also tried logging a message to the console after call.answer() in the on stream event callback to no avail. Example below.

peer.on('call', function(call) {
console.log('call heard');
var myStream = navigator.getUserMedia(constraints, successCb, errorCb);
call.answer(myStream);
call.on('stream', function() {
lessonFactory.broadcastAssembly(myStream);
console.log('call streaming');
});
});


Also, after creating an instance of the on stream event I receive an error message of "Cannot read property 'on' of undefined". So, is there something wrong with the peer.call() method or am I doing something wrong? Example below.

var call = peer.call(id, myStream);
call.on('stream', function(remoteStream) {
console.log('stream success');
callFactory.broadcastAssembly(remoteStream);
});

Michael King

unread,
Oct 20, 2016, 1:26:32 AM10/20/16
to PeerJS
You should check that the peer.call function returns something - the error you are getting tells me it's returning null, ie it's failing in peer.call() 

If you set debug level 3 when you create new Peer, you will see console output which will help you troubleshoot 
 
Reply all
Reply to author
Forward
0 new messages