Switches the order of the parameters of desktopsharing.addListener to match the rest of the code. Renames variables.

This commit is contained in:
Boris Grozev 2015-08-24 14:59:26 -05:00
parent 82c45a2e38
commit dc2b63fc60
4 changed files with 23 additions and 23 deletions

View File

@ -151,9 +151,10 @@ var RTC = {
start: function () {
var self = this;
APP.desktopsharing.addListener(
DesktopSharingEventTypes.NEW_STREAM_CREATED,
function (stream, isUsingScreenStream, callback) {
self.changeLocalVideo(stream, isUsingScreenStream, callback);
}, DesktopSharingEventTypes.NEW_STREAM_CREATED);
});
APP.xmpp.addListener(XMPPEvents.CALL_INCOMING, function(event) {
DataChannels.init(event.peerconnection, eventEmitter);
});
@ -195,13 +196,13 @@ var RTC = {
}
return false;
},
switchVideoStreams: function (new_stream) {
this.localVideo.stream = new_stream;
switchVideoStreams: function (newStream) {
this.localVideo.stream = newStream;
this.localStreams = [];
//in firefox we have only one stream object
if (this.localAudio.getOriginalStream() != new_stream)
if (this.localAudio.getOriginalStream() != newStream)
this.localStreams.push(this.localAudio);
this.localStreams.push(this.localVideo);
},
@ -227,7 +228,7 @@ var RTC = {
// Stop the stream to trigger onended event for old stream
oldStream.stop();
this.switchVideoStreams(videoStream, oldStream);
this.switchVideoStreams(videoStream);
APP.xmpp.switchStreams(videoStream, oldStream,localCallback);
},

View File

@ -193,12 +193,12 @@ function registerListeners() {
AudioLevels.updateAudioLevel(resourceJid, audioLevel,
UI.getLargeVideoResource());
});
APP.desktopsharing.addListener(function () {
ToolbarToggler.showDesktopSharingButton();
}, DesktopSharingEventTypes.INIT);
APP.desktopsharing.addListener(
Toolbar.changeDesktopSharingButtonState,
DesktopSharingEventTypes.SWITCHING_DONE);
DesktopSharingEventTypes.INIT,
ToolbarToggler.showToolbar);
APP.desktopsharing.addListener(
DesktopSharingEventTypes.SWITCHING_DONE,
Toolbar.changeDesktopSharingButtonState);
APP.connectionquality.addListener(CQEvents.LOCALSTATS_UPDATED,
VideoLayout.updateLocalConnectionStats);
APP.connectionquality.addListener(CQEvents.REMOTESTATS_UPDATED,

View File

@ -329,12 +329,11 @@ module.exports = {
APP.RTC.addListener(RTCEvents.RTC_READY, onWebRtcReady);
},
addListener: function (listener, type)
{
addListener: function (type, listener) {
eventEmitter.on(type, listener);
},
removeListener: function (listener, type) {
removeListener: function (type, listener) {
eventEmitter.removeListener(type, listener);
},

View File

@ -1066,28 +1066,28 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
/**
* Switches video streams.
* @param new_stream new stream that will be used as video of this session.
* @param newStream new stream that will be used as video of this session.
* @param oldStream old video stream of this session.
* @param success_callback callback executed after successful stream switch.
* @param successCallback callback executed after successful stream switch.
*/
JingleSessionPC.prototype.switchStreams = function (new_stream, oldStream, success_callback, isAudio) {
JingleSessionPC.prototype.switchStreams = function (newStream, oldStream, successCallback) {
var self = this;
// Remember SDP to figure out added/removed SSRCs
var oldSdp = null;
if(self.peerconnection) {
if(self.peerconnection.localDescription) {
if (self.peerconnection) {
if (self.peerconnection.localDescription) {
oldSdp = new SDP(self.peerconnection.localDescription.sdp);
}
self.peerconnection.removeStream(oldStream, true);
if(new_stream)
self.peerconnection.addStream(new_stream);
if (newStream)
self.peerconnection.addStream(newStream);
}
// Conference is not active
if(!oldSdp || !self.peerconnection) {
success_callback();
if (!oldSdp) {
successCallback();
return;
}
@ -1095,7 +1095,7 @@ JingleSessionPC.prototype.switchStreams = function (new_stream, oldStream, succe
self.modifySourcesQueue.push(function() {
console.log('modify sources done');
success_callback();
successCallback();
var newSdp = new SDP(self.peerconnection.localDescription.sdp);
console.log("SDPs", oldSdp, newSdp);