Fixes video mute when the user is alone in the room.

This commit is contained in:
hristoterezov 2015-03-18 18:41:41 +02:00
parent 0da2547360
commit 44e558e5a0
6 changed files with 69 additions and 61 deletions

View File

@ -19,7 +19,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=39"></script>
<script src="libs/app.bundle.js?v=40"></script>
<script src="analytics.js?v=1"></script><!-- google analytics plugin -->
<link rel="stylesheet" href="css/font.css?v=6"/>
<link rel="stylesheet" href="css/toastr.css?v=1">

View File

@ -1937,8 +1937,6 @@ UI.getRoomName = function () {
* Mutes/unmutes the local video.
*/
UI.toggleVideo = function () {
UIUtil.buttonClick("#video", "icon-camera icon-camera-disabled");
setVideoMute(!APP.RTC.localVideo.isMuted());
};
@ -8295,7 +8293,7 @@ var VideoLayout = (function (my) {
*/
$(document).bind('videomuted.muc', function (event, jid, value) {
var isMuted = (value === "true");
if(!APP.RTC.muteRemoteVideoStream(jid, isMuted))
if(jid !== APP.xmpp.myJid() && !APP.RTC.muteRemoteVideoStream(jid, isMuted))
return;
Avatar.showUserAvatar(jid, isMuted);
@ -13177,30 +13175,9 @@ JingleSession.prototype.setVideoMute = function (mute, callback, options) {
return;
}
var self = this;
var localCallback = function (mute) {
self.connection.emuc.addVideoInfoToPresence(mute);
self.connection.emuc.sendPresence();
return callback(mute)
};
if (mute == APP.RTC.localVideo.isMuted())
{
// Even if no change occurs, the specified callback is to be executed.
// The specified callback may, optionally, return a successCallback
// which is to be executed as well.
var successCallback = localCallback(mute);
if (successCallback) {
successCallback();
}
} else {
APP.RTC.localVideo.setMute(!mute);
this.hardMuteVideo(mute);
this.modifySources(localCallback(mute));
}
this.modifySources(callback(mute));
};
// SDP-based mute by going recvonly/sendrecv
@ -16933,9 +16910,36 @@ var XMPP = {
}
},
setVideoMute: function (mute, callback, options) {
if(connection && APP.RTC.localVideo && connection.jingle.activecall)
if(!connection || !APP.RTC.localVideo)
return;
var localCallback = function (mute) {
connection.emuc.addVideoInfoToPresence(mute);
connection.emuc.sendPresence();
return callback(mute);
};
if (mute == APP.RTC.localVideo.isMuted())
{
connection.jingle.activecall.setVideoMute(mute, callback, options);
// Even if no change occurs, the specified callback is to be executed.
// The specified callback may, optionally, return a successCallback
// which is to be executed as well.
var successCallback = localCallback(mute);
if (successCallback) {
successCallback();
}
} else {
APP.RTC.localVideo.setMute(!mute);
if(connection.jingle.activecall)
{
connection.jingle.activecall.setVideoMute(
mute, localCallback, options);
}
else {
localCallback(mute);
}
}
},
setAudioMute: function (mute, callback) {

View File

@ -694,8 +694,6 @@ UI.getRoomName = function () {
* Mutes/unmutes the local video.
*/
UI.toggleVideo = function () {
UIUtil.buttonClick("#video", "icon-camera icon-camera-disabled");
setVideoMute(!APP.RTC.localVideo.isMuted());
};

View File

@ -1787,7 +1787,7 @@ var VideoLayout = (function (my) {
*/
$(document).bind('videomuted.muc', function (event, jid, value) {
var isMuted = (value === "true");
if(!APP.RTC.muteRemoteVideoStream(jid, isMuted))
if(jid !== APP.xmpp.myJid() && !APP.RTC.muteRemoteVideoStream(jid, isMuted))
return;
Avatar.showUserAvatar(jid, isMuted);

View File

@ -1109,30 +1109,9 @@ JingleSession.prototype.setVideoMute = function (mute, callback, options) {
return;
}
var self = this;
var localCallback = function (mute) {
self.connection.emuc.addVideoInfoToPresence(mute);
self.connection.emuc.sendPresence();
return callback(mute)
};
if (mute == APP.RTC.localVideo.isMuted())
{
// Even if no change occurs, the specified callback is to be executed.
// The specified callback may, optionally, return a successCallback
// which is to be executed as well.
var successCallback = localCallback(mute);
if (successCallback) {
successCallback();
}
} else {
APP.RTC.localVideo.setMute(!mute);
this.hardMuteVideo(mute);
this.modifySources(localCallback(mute));
}
this.modifySources(callback(mute));
};
// SDP-based mute by going recvonly/sendrecv

View File

@ -252,9 +252,36 @@ var XMPP = {
}
},
setVideoMute: function (mute, callback, options) {
if(connection && APP.RTC.localVideo && connection.jingle.activecall)
if(!connection || !APP.RTC.localVideo)
return;
var localCallback = function (mute) {
connection.emuc.addVideoInfoToPresence(mute);
connection.emuc.sendPresence();
return callback(mute);
};
if (mute == APP.RTC.localVideo.isMuted())
{
connection.jingle.activecall.setVideoMute(mute, callback, options);
// Even if no change occurs, the specified callback is to be executed.
// The specified callback may, optionally, return a successCallback
// which is to be executed as well.
var successCallback = localCallback(mute);
if (successCallback) {
successCallback();
}
} else {
APP.RTC.localVideo.setMute(!mute);
if(connection.jingle.activecall)
{
connection.jingle.activecall.setVideoMute(
mute, localCallback, options);
}
else {
localCallback(mute);
}
}
},
setAudioMute: function (mute, callback) {