- From: Jan-Ivar Bruaroey <jib@mozilla.com>
- Date: Tue, 04 Jun 2013 11:09:41 -0400
- To: public-webrtc@w3.org
On 6/3/13 6:09 PM, cowwoc wrote:
>> Is that about right?
> Almost. This code doesn't make sense to me:
> "then(pc2.setRemoteDescription(offer););"
>
> then() expects you to pass in a callback.
> "pc2.setRemoteDescription(offer)" returns a Future, not a callback. I
> think you'd have to surround the call with "function(){}" to fix the code.
Thanks for catching that.
function simpletest_newapi() {
var pc1 = new RTCPeerConnection();
var pc2 = new RTCPeerConnection();
navigator.GetUserMedia({video:true})
.then(function(video1) {
pc1.addStream(video1);
return pc1.createOffer();
})
.then(function(offer) {
return pc1.setLocalDescription(offer)
.then(function() { return pc2.setRemoteDescription(offer); });
})
.then(pc2.createAnswer())
.then(function(answer) {
return pc2.setLocalDescription(answer)
.then(function() { return pc1.setRemoteDescription(answer); });
})
.then(finish, fail);
}
.: Jan-Ivar :.
> Gili
Received on Tuesday, 4 June 2013 15:10:11 UTC