button.onclick = function() { //hangup first easyrtc.hangupAll();
selectedRemoteStream = this.innerHTML;//stream name from button text //send stream name to otherEasyrtcid easyrtc.sendData(otherEasyrtcid, "setStream", selectedRemoteStream, function(ackMsg){ console.log("setStream acknowledgment " + JSON.stringify(ackMsg)); } ); //call otherEasyrtcid performReCall(otherEasyrtcid);
}
easyrtc.setAcceptChecker(function(easyrtcid, callback) { console.log("stream accepted"); otherEasyrtcid = easyrtcid;
if(ownerStreams[otherEasyrtcid] == null)
{ ownerStreams[otherEasyrtcid] = 'Camera: 1'; }
callback(true); if( otherEasyrtcid) { console.log("add stream to call"); easyrtc.addStreamToCall(otherEasyrtcid, ownerStreams[otherEasyrtcid], function(easyrtcid, streamName){ console.log("other party " + easyrtcid + " acknowledges receiving " + streamName); }); }});