Removes unused remoteStream variable. Fixes stream removal from remoteStreams array.

This commit is contained in:
paweldomas 2014-03-12 18:11:14 +01:00
parent 9fd03e1bef
commit a2633e20e8
2 changed files with 5 additions and 8 deletions

View File

@ -102,14 +102,10 @@ ColibriFocus.prototype.makeConference = function (peers) {
*/ */
}; };
this.peerconnection.onaddstream = function (event) { this.peerconnection.onaddstream = function (event) {
self.remoteStream = event.stream;
// search the jid associated with this stream // search the jid associated with this stream
Object.keys(self.remotessrc).forEach(function (jid) { Object.keys(self.remotessrc).forEach(function (jid) {
if (self.remotessrc[jid].join('\r\n').indexOf('mslabel:' + event.stream.id) != -1) { if (self.remotessrc[jid].join('\r\n').indexOf('mslabel:' + event.stream.id) != -1) {
event.peerjid = jid; event.peerjid = jid;
if (self.connection.jingle.jid2session[jid]) {
self.connection.jingle.jid2session[jid].remotestream = event.stream;
}
} }
}); });
$(document).trigger('remotestreamadded.jingle', [event, self.sid]); $(document).trigger('remotestreamadded.jingle', [event, self.sid]);

View File

@ -22,7 +22,6 @@ function JingleSession(me, sid, connection) {
console.error(e); console.error(e);
} }
this.remoteStream = null;
this.localSDP = null; this.localSDP = null;
this.remoteSDP = null; this.remoteSDP = null;
this.localStreams = []; this.localStreams = [];
@ -69,13 +68,15 @@ JingleSession.prototype.initiate = function (peerjid, isInitiator) {
self.sendIceCandidate(event.candidate); self.sendIceCandidate(event.candidate);
}; };
this.peerconnection.onaddstream = function (event) { this.peerconnection.onaddstream = function (event) {
self.remoteStream = event.stream;
self.remoteStreams.push(event.stream); self.remoteStreams.push(event.stream);
$(document).trigger('remotestreamadded.jingle', [event, self.sid]); $(document).trigger('remotestreamadded.jingle', [event, self.sid]);
}; };
this.peerconnection.onremovestream = function (event) { this.peerconnection.onremovestream = function (event) {
self.remoteStream = null; // Remove the stream from remoteStreams
// FIXME: remove from this.remoteStreams var streamIdx = self.remoteStreams.indexOf(event.stream);
if(streamIdx !== -1){
self.remoteStreams.splice(streamIdx, 1);
}
// FIXME: remotestreamremoved.jingle not defined anywhere(unused) // FIXME: remotestreamremoved.jingle not defined anywhere(unused)
$(document).trigger('remotestreamremoved.jingle', [event, self.sid]); $(document).trigger('remotestreamremoved.jingle', [event, self.sid]);
}; };