Fixes issue with switching to the screen stream before conference starts(when we're still alone in the room).

This commit is contained in:
paweldomas 2015-07-09 15:04:08 +02:00
parent 5c136f1da6
commit 6ec7be09f2
6 changed files with 27 additions and 15 deletions

View File

@ -22,7 +22,7 @@
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
<script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
<script src="interface_config.js?v=5"></script>
<script src="libs/app.bundle.js?v=97"></script>
<script src="libs/app.bundle.js?v=98"></script>
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
<link rel="stylesheet" href="css/font.css?v=7"/>
<link rel="stylesheet" href="css/toastr.css?v=1">

View File

@ -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);
}

View File

@ -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) {

View File

@ -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());
};

View File

@ -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();

View File

@ -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);
}