diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index 677a6320a..11caab9c2 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -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); }, diff --git a/modules/UI/UI.js b/modules/UI/UI.js index b73662dc4..1e36ef757 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -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, diff --git a/modules/desktopsharing/desktopsharing.js b/modules/desktopsharing/desktopsharing.js index 393d2fd66..c26bad6dc 100644 --- a/modules/desktopsharing/desktopsharing.js +++ b/modules/desktopsharing/desktopsharing.js @@ -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); }, diff --git a/modules/xmpp/JingleSessionPC.js b/modules/xmpp/JingleSessionPC.js index 5fc78bfe6..716734fb0 100644 --- a/modules/xmpp/JingleSessionPC.js +++ b/modules/xmpp/JingleSessionPC.js @@ -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);