Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Fixes inconsistent local video muted status.

paweldomas8469a282c1c8
diff --git a/modules/RTC/LocalStream.js b/modules/RTC/LocalStream.js
index 342fbb57cc..333b1db75e 100644
--- a/modules/RTC/LocalStream.js
+++ b/modules/RTC/LocalStream.js
@@ -44,29 +44,27 @@ LocalStream.prototype.isAudioStream = function () {
return this.type === "audio";
};
-LocalStream.prototype.setMute = function(mute)
+LocalStream.prototype.setMute = function (mute)
{
+ var isAudio = this.isAudioStream();
+ var eventType = isAudio ? RTCEvents.AUDIO_MUTE : RTCEvents.VIDEO_MUTE;
- if((window.location.protocol != "https:" && this.isGUMStream) ||
- (this.isAudioStream() && this.isGUMStream) || this.videoType === "screen")
+ if ((window.location.protocol != "https:" && this.isGUMStream) ||
+ (isAudio && this.isGUMStream) || this.videoType === "screen")
{
var tracks = this.getTracks();
for (var idx = 0; idx < tracks.length; idx++) {
- tracks[idx].enabled = mute;
+ tracks[idx].enabled = !mute;
}
- this.eventEmitter.emit(
- (this.type == "audio"? RTCEvents.AUDIO_MUTE : RTCEvents.VIDEO_MUTE),
- !mute);
+ this.eventEmitter.emit(eventType, mute);
}
else
{
- if(mute === false) {
+ if (mute) {
APP.xmpp.removeStream(this.stream);
this.stream.stop();
- this.eventEmitter.emit(
- (this.type == "audio"? RTCEvents.AUDIO_MUTE : RTCEvents.VIDEO_MUTE),
- true);
+ this.eventEmitter.emit(eventType, true);
}
else
{
@@ -74,22 +72,18 @@ LocalStream.prototype.setMute = function(mute)
APP.RTC.rtcUtils.obtainAudioAndVideoPermissions(
(this.isAudioStream() ? ["audio"] : ["video"]),
function (stream) {
- if(self.isAudioStream())
+ if (isAudio)
{
APP.RTC.changeLocalAudio(stream,
function () {
- self.eventEmitter.emit(
- (self.type == "audio"? RTCEvents.AUDIO_MUTE : RTCEvents.VIDEO_MUTE),
- true);
+ self.eventEmitter.emit(eventType, false);
});
}
else
{
APP.RTC.changeLocalVideo(stream, false,
function () {
- self.eventEmitter.emit(
- (self.type == "audio"? RTCEvents.AUDIO_MUTE : RTCEvents.VIDEO_MUTE),
- true);
+ self.eventEmitter.emit(eventType, false);
});
}
});
diff --git a/modules/RTC/RTC.js b/modules/RTC/RTC.js
index 4c545d608e..fb218b32b1 100644
--- a/modules/RTC/RTC.js
+++ b/modules/RTC/RTC.js
@@ -274,19 +274,19 @@ var RTC = {
return isDesktop;
},
- setVideoMute: function(mute, callback, options) {
- if(!this.localVideo)
+ setVideoMute: function (mute, callback, options) {
+ if (!this.localVideo)
return;
if (mute == APP.RTC.localVideo.isMuted())
{
APP.xmpp.sendVideoInfoPresence(mute);
- if(callback)
+ if (callback)
callback(mute);
}
else
{
- APP.RTC.localVideo.setMute(!mute);
+ APP.RTC.localVideo.setMute(mute);
APP.xmpp.setVideoMute(
mute,
callback,