Skip to content

Commit

Permalink
put createAnswer inside setRemoteDescription callback (??)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincennis committed Apr 13, 2013
1 parent c805d00 commit 84c71e6
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions public/js/sample.js
Expand Up @@ -73,18 +73,19 @@ function evtHandler( data ){
_id = data.id;
break;
case 'receiver_offer':
pc.setRemoteDescription(new RTCSessionDescription(data));
pc.createAnswer(function( description ){
console.log('sending answer');
pc.setLocalDescription(description);
socket.send(JSON.stringify({
type: 'received_answer',
data: description,
id: _id
}));
}, function(){
console.log(arguments);
}, constraints);
pc.setRemoteDescription(new RTCSessionDescription(data), function(){
pc.createAnswer(function( description ){
console.log('sending answer');
pc.setLocalDescription(description);
socket.send(JSON.stringify({
type: 'received_answer',
data: description,
id: _id
}));
}, function(){
console.log(arguments);
}, constraints);
});
break;
case 'received_answer':
if ( connected ) return;
Expand Down

0 comments on commit 84c71e6

Please sign in to comment.