Addressed review comments.
This commit is contained in:
Родитель
ceea68078d
Коммит
7682abe3bd
|
@ -40,15 +40,9 @@ window.onload = function() {
|
|||
log("sender connected: " + JSON.stringify(event));
|
||||
}
|
||||
window.castReceiverManager.onReady = function(event) {
|
||||
log("on ready");
|
||||
try {
|
||||
log("onReady: " + JSON.stringify(event));
|
||||
} catch(e) {
|
||||
log(e);
|
||||
}
|
||||
log("onReady: " + JSON.stringify(event));
|
||||
}
|
||||
window.messageBus = window.castReceiverManager.getCastMessageBus('urn:x-cast:org.mozilla.mirror');
|
||||
log("bus: " + messageBus);
|
||||
window.messageBus.onMessage = function(event) {
|
||||
log("onMessage called with: " + event.data);
|
||||
client.processEvent(event.senderId, event.data);
|
||||
|
|
23
player.js
23
player.js
|
@ -10,9 +10,7 @@ var failure = function(x) {
|
|||
var CallingClient = function(divs) {
|
||||
log("Calling client constructor");
|
||||
|
||||
var config = {}
|
||||
config.iceServers = [];
|
||||
config.iceServers.push({"url":"stun:stun.services.mozilla.com"});
|
||||
var config = {"iceServers":[{"url":"stun:stun.services.mozilla.com"}]};
|
||||
|
||||
// webkitRTCPeerConnection is Chrome specific
|
||||
this.pc = new webkitRTCPeerConnection(config, {});
|
||||
|
@ -82,29 +80,14 @@ CallingClient.prototype = {
|
|||
this.pc.createAnswer(this._createAnswerSuccess.bind(this), failure);
|
||||
},
|
||||
|
||||
_setLocalSuccessAnswer: function(sdp) {
|
||||
_setLocalAnswerSuccess: function(sdp) {
|
||||
log("Successfully applied local description: " + JSON.stringify(sdp));
|
||||
},
|
||||
|
||||
_filterNonrelayCandidates: function(sdp) {
|
||||
var lines = sdp.sdp.split("\r\n");
|
||||
var lines2 = lines.filter(function(x) {
|
||||
if (!/candidate/.exec(x)) {
|
||||
return true;
|
||||
} else if (/relay/.exec(x)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
sdp.sdp = lines2.join("\r\n");
|
||||
},
|
||||
|
||||
_createAnswerSuccess: function(sdp) {
|
||||
log("Successfully created answer " + JSON.stringify(sdp));
|
||||
this._filterNonrelayCandidates(sdp);
|
||||
this._sendMessage(sdp);
|
||||
this.pc.setLocalDescription(sdp, this._setLocalSuccessAnswer, failure);
|
||||
this.pc.setLocalDescription(sdp, this._setLocalAnswerSuccess, failure);
|
||||
},
|
||||
|
||||
_onIceCandidate: function (candidate) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче