style(isVideoPlayable): improve readability.

This commit is contained in:
Hristo Terezov 2021-01-06 17:50:28 -06:00
parent 2e5e9a3f79
commit 9f321c988e
1 changed files with 5 additions and 4 deletions

View File

@ -86,7 +86,6 @@ export function isVideoPlayable(stateful: Object | Function, id: String) {
const state = toState(stateful);
const tracks = state['features/base/tracks'];
const participant = id ? getParticipantById(state, id) : getLocalParticipant(state);
let isVideoMuted = true;
const isLocal = participant?.local ?? true;
const { connectionStatus } = participant || {};
const videoTrack
@ -94,11 +93,13 @@ export function isVideoPlayable(stateful: Object | Function, id: String) {
const isAudioOnly = Boolean(state['features/base/audio-only'].enabled);
let isPlayable = false;
if (participant?.local) {
isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
if (isLocal) {
const isVideoMuted = isLocalTrackMuted(tracks, MEDIA_TYPE.VIDEO);
isPlayable = Boolean(videoTrack) && !isVideoMuted && !isAudioOnly;
} else if (!participant?.isFakeParticipant) { // remote participants excluding shared video
isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, id);
const isVideoMuted = isRemoteTrackMuted(tracks, MEDIA_TYPE.VIDEO, id);
isPlayable = Boolean(videoTrack) && !isVideoMuted && !isAudioOnly
&& connectionStatus === JitsiParticipantConnectionStatus.ACTIVE;
}