fix(VideoLayout): muted for no tracks

Will make the UI display audio/video muted icon for remote participants
with no audio/video track.
This commit is contained in:
paweldomas 2017-07-19 12:08:51 +02:00
parent 6493b09565
commit 00d3d3c09a
2 changed files with 32 additions and 9 deletions

View File

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

View File

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