Skip to content

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

fix(VideoLayout): muted for no tracks

paweldomas00d3d3c09adb
diff --git a/conference.js b/conference.js
index ef1099acc3..06bcf4287a 100644
--- a/conference.js
+++ b/conference.js
@@ -486,8 +486,6 @@ export default {
// First try to retrieve both audio and video.
let tryCreateLocalTracks;
- // FIXME there is no video muted indication visible on the remote side,
- // after starting in audio only (there's no video track)
// FIXME the logic about trying to go audio only on error is duplicated
if (options.startAudioOnly) {
tryCreateLocalTracks
diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js
index 03872a3fea..de32326341 100644
--- a/modules/UI/videolayout/VideoLayout.js
+++ b/modules/UI/videolayout/VideoLayout.js
@@ -331,13 +331,11 @@ var VideoLayout = {
remoteVideo.addRemoteStreamElement(stream);
- // if track is muted make sure we reflect that
- if(stream.isMuted())
- {
- if(stream.getType() === "audio")
- this.onAudioMute(stream.getParticipantId(), true);
- else
- this.onVideoMute(stream.getParticipantId(), true);
+ // Make sure track's muted state is reflected
+ if (stream.getType() === "audio") {
+ this.onAudioMute(stream.getParticipantId(), stream.isMuted());
+ } else {
+ this.onVideoMute(stream.getParticipantId(), stream.isMuted());
}
},
@@ -348,6 +346,30 @@ var VideoLayout = {
if (remoteVideo) {
remoteVideo.removeRemoteStreamElement(stream);
}
+ this.updateMutedForNoTracks(id, stream.getType());
+ },
+
+ /**
+ * FIXME get rid of this method once muted indicator are reactified (by
+ * making sure that user with no tracks is displayed as muted )
+ *
+ * If participant has no tracks will make the UI display muted status.
+ * @param {string} participantId
+ * @param {string} mediaType 'audio' or 'video'
+ */
+ updateMutedForNoTracks(participantId, mediaType) {
+ const participant = APP.conference.getParticipantById(participantId);
+
+ if (participant
+ && !participant.getTracksByMediaType(mediaType).length) {
+ if (mediaType === 'audio') {
+ APP.UI.setAudioMuted(participantId, true);
+ } else if (mediaType === 'video') {
+ APP.UI.setVideoMuted(participantId, true);
+ } else {
+ logger.error(`Unsupported media type: ${mediaType}`);
+ }
+ }
},
/**
@@ -441,6 +463,9 @@ var VideoLayout = {
this._setRemoteControlProperties(user, remoteVideo);
this.addRemoteVideoContainer(id, remoteVideo);
+ this.updateMutedForNoTracks(id, 'audio');
+ this.updateMutedForNoTracks(id, 'video');
+
const remoteVideosCount = Object.keys(remoteVideos).length;
if (remoteVideosCount === 1) {