diff --git a/index.html b/index.html index 9f7ab9e08..aa08c8e5e 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@ - + diff --git a/libs/app.bundle.js b/libs/app.bundle.js index 56f870469..38f230c37 100644 --- a/libs/app.bundle.js +++ b/libs/app.bundle.js @@ -1325,6 +1325,9 @@ var RTC = { this.localVideo = this.createLocalStream(videoStream, "video", true, type); // Stop the stream to trigger onended event for old stream oldStream.stop(); + + this.switchVideoStreams(videoStream, oldStream); + APP.xmpp.switchStreams(videoStream, oldStream,localCallback); }, changeLocalAudio: function (stream, callback) { @@ -8591,7 +8594,10 @@ var VideoLayout = (function (my) { localVideoThumbnail.changeVideo(stream, isMuted); - LargeVideo.updateLargeVideo(APP.xmpp.myResource()); + LargeVideo.updateLargeVideo( + APP.xmpp.myResource(), + /* force update only before conference starts */ + !APP.xmpp.isConferenceInProgress()); }; @@ -12768,9 +12774,6 @@ JingleSession.prototype.switchStreams = function (new_stream, oldStream, success self.peerconnection.addStream(new_stream); } - if(!isAudio) - APP.RTC.switchVideoStreams(new_stream, oldStream); - // Conference is not active if(!oldSdp || !self.peerconnection) { success_callback(); @@ -16846,8 +16849,12 @@ var XMPP = { isExternalAuthEnabled: function () { return Moderator.isExternalAuthEnabled(); }, + isConferenceInProgress: function () { + return connection && connection.jingle.activecall && + connection.jingle.activecall.peerconnection; + }, switchStreams: function (stream, oldStream, callback, isAudio) { - if (connection && connection.jingle.activecall) { + if (this.isConferenceInProgress()) { // FIXME: will block switchInProgress on true value in case of exception connection.jingle.activecall.switchStreams(stream, oldStream, callback, isAudio); } else { @@ -17085,8 +17092,7 @@ var XMPP = { return connection.jingle.sessions; }, removeStream: function (stream) { - if(!connection || !connection.jingle.activecall || - !connection.jingle.activecall.peerconnection) + if (!this.isConferenceInProgress()) return; connection.jingle.activecall.peerconnection.removeStream(stream); } diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js index 4f873536b..1074267e4 100644 --- a/modules/RTC/RTC.js +++ b/modules/RTC/RTC.js @@ -215,6 +215,9 @@ var RTC = { this.localVideo = this.createLocalStream(videoStream, "video", true, type); // Stop the stream to trigger onended event for old stream oldStream.stop(); + + this.switchVideoStreams(videoStream, oldStream); + APP.xmpp.switchStreams(videoStream, oldStream,localCallback); }, changeLocalAudio: function (stream, callback) { diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index 8c70476e9..a3b5a56da 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -64,7 +64,10 @@ var VideoLayout = (function (my) { localVideoThumbnail.changeVideo(stream, isMuted); - LargeVideo.updateLargeVideo(APP.xmpp.myResource()); + LargeVideo.updateLargeVideo( + APP.xmpp.myResource(), + /* force update only before conference starts */ + !APP.xmpp.isConferenceInProgress()); }; diff --git a/modules/xmpp/JingleSession.js b/modules/xmpp/JingleSession.js index 99253cf37..549206255 100644 --- a/modules/xmpp/JingleSession.js +++ b/modules/xmpp/JingleSession.js @@ -1020,9 +1020,6 @@ JingleSession.prototype.switchStreams = function (new_stream, oldStream, success self.peerconnection.addStream(new_stream); } - if(!isAudio) - APP.RTC.switchVideoStreams(new_stream, oldStream); - // Conference is not active if(!oldSdp || !self.peerconnection) { success_callback(); diff --git a/modules/xmpp/xmpp.js b/modules/xmpp/xmpp.js index 6587bf524..3ff7741ed 100644 --- a/modules/xmpp/xmpp.js +++ b/modules/xmpp/xmpp.js @@ -362,8 +362,12 @@ var XMPP = { isExternalAuthEnabled: function () { return Moderator.isExternalAuthEnabled(); }, + isConferenceInProgress: function () { + return connection && connection.jingle.activecall && + connection.jingle.activecall.peerconnection; + }, switchStreams: function (stream, oldStream, callback, isAudio) { - if (connection && connection.jingle.activecall) { + if (this.isConferenceInProgress()) { // FIXME: will block switchInProgress on true value in case of exception connection.jingle.activecall.switchStreams(stream, oldStream, callback, isAudio); } else { @@ -601,8 +605,7 @@ var XMPP = { return connection.jingle.sessions; }, removeStream: function (stream) { - if(!connection || !connection.jingle.activecall || - !connection.jingle.activecall.peerconnection) + if (!this.isConferenceInProgress()) return; connection.jingle.activecall.peerconnection.removeStream(stream); }