|
|
|
|
@ -2,7 +2,7 @@ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
import { getGravatarURL } from '@jitsi/js-utils/avatar'; |
|
|
|
|
|
|
|
|
|
import { IStore } from '../../app/types'; |
|
|
|
|
import { IState, IStore } from '../../app/types'; |
|
|
|
|
// @ts-ignore
|
|
|
|
|
import { isStageFilmstripAvailable } from '../../filmstrip/functions'; |
|
|
|
|
import { IStateful } from '../app/types'; |
|
|
|
|
@ -24,7 +24,7 @@ import { |
|
|
|
|
} from './constants'; |
|
|
|
|
// @ts-ignore
|
|
|
|
|
import { preloadImage } from './preloadImage'; |
|
|
|
|
import { Participant } from './types'; |
|
|
|
|
import { FakeParticipant, Participant } from './types'; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Temp structures for avatar urls to be checked/preloaded. |
|
|
|
|
@ -34,10 +34,10 @@ const AVATAR_CHECKED_URLS = new Map(); |
|
|
|
|
/* eslint-disable arrow-body-style, no-unused-vars */ |
|
|
|
|
const AVATAR_CHECKER_FUNCTIONS = [ |
|
|
|
|
(participant: Participant) => { |
|
|
|
|
return participant?.isJigasi ? JIGASI_PARTICIPANT_ICON : null; |
|
|
|
|
return isJigasiParticipant(participant) ? JIGASI_PARTICIPANT_ICON : null; |
|
|
|
|
}, |
|
|
|
|
(participant: Participant) => { |
|
|
|
|
return participant?.isWhiteboard ? WHITEBOARD_PARTICIPANT_ICON : null; |
|
|
|
|
return isWhiteboardParticipant(participant) ? WHITEBOARD_PARTICIPANT_ICON : null; |
|
|
|
|
}, |
|
|
|
|
(participant: Participant) => { |
|
|
|
|
return participant?.avatarURL ? participant.avatarURL : null; |
|
|
|
|
@ -115,7 +115,7 @@ export function getActiveSpeakersToBeDisplayed(stateful: IStateful) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Remove shared video from the count.
|
|
|
|
|
// Remove fake participants from the count.
|
|
|
|
|
if (fakeParticipants) { |
|
|
|
|
availableSlotsForActiveSpeakers -= fakeParticipants.size; |
|
|
|
|
} |
|
|
|
|
@ -301,6 +301,69 @@ export function getFakeParticipants(stateful: IStateful) { |
|
|
|
|
return toState(stateful)['features/base/participants'].fakeParticipants; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns whether the fake participant is Jigasi. |
|
|
|
|
* |
|
|
|
|
* @param {Participant|undefined} participant - The participant entity. |
|
|
|
|
* @returns {boolean} - True if it's a Jigasi participant. |
|
|
|
|
*/ |
|
|
|
|
function isJigasiParticipant(participant?: Participant): boolean { |
|
|
|
|
return participant?.fakeParticipant === FakeParticipant.Jigasi; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns whether the fake participant is a local screenshare. |
|
|
|
|
* |
|
|
|
|
* @param {Participant|undefined} participant - The participant entity. |
|
|
|
|
* @returns {boolean} - True if it's a local screenshare participant. |
|
|
|
|
*/ |
|
|
|
|
export function isLocalScreenshareParticipant(participant?: Participant): boolean { |
|
|
|
|
return participant?.fakeParticipant === FakeParticipant.LocalScreenShare; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns whether the fake participant is a remote screenshare. |
|
|
|
|
* |
|
|
|
|
* @param {Participant|undefined} participant - The participant entity. |
|
|
|
|
* @returns {boolean} - True if it's a remote screenshare participant. |
|
|
|
|
*/ |
|
|
|
|
export function isRemoteScreenshareParticipant(participant?: Participant): boolean { |
|
|
|
|
return participant?.fakeParticipant === FakeParticipant.RemoteScreenShare; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns whether the fake participant is of local or virtual screenshare type. |
|
|
|
|
* |
|
|
|
|
* @param {IState} state - The (whole) redux state, or redux's. |
|
|
|
|
* @param {string|undefined} participantId - The participant id. |
|
|
|
|
* @returns {boolean} - True if it's one of the two. |
|
|
|
|
*/ |
|
|
|
|
export function isScreenShareParticipantById(state: IState, participantId?: string): boolean { |
|
|
|
|
const participant = getParticipantByIdOrUndefined(state, participantId); |
|
|
|
|
|
|
|
|
|
return isScreenShareParticipant(participant); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns whether the fake participant is of local or virtual screenshare type. |
|
|
|
|
* |
|
|
|
|
* @param {Participant|undefined} participant - The participant entity. |
|
|
|
|
* @returns {boolean} - True if it's one of the two. |
|
|
|
|
*/ |
|
|
|
|
export function isScreenShareParticipant(participant?: Participant): boolean { |
|
|
|
|
return isLocalScreenshareParticipant(participant) || isRemoteScreenshareParticipant(participant); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns whether the fake participant is a whiteboard. |
|
|
|
|
* |
|
|
|
|
* @param {Participant|undefined} participant - The participant entity. |
|
|
|
|
* @returns {boolean} - True if it's a whiteboard participant. |
|
|
|
|
*/ |
|
|
|
|
export function isWhiteboardParticipant(participant?: Participant): boolean { |
|
|
|
|
return participant?.fakeParticipant === FakeParticipant.Whiteboard; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a count of the known remote participants in the passed in redux state. |
|
|
|
|
* |
|
|
|
|
@ -349,15 +412,16 @@ export function getParticipantCountWithFake(stateful: IStateful) { |
|
|
|
|
* @returns {string} |
|
|
|
|
*/ |
|
|
|
|
export function getParticipantDisplayName(stateful: IStateful, id: string): string { |
|
|
|
|
const participant = getParticipantById(stateful, id); |
|
|
|
|
const state = toState(stateful); |
|
|
|
|
const participant = getParticipantById(state, id); |
|
|
|
|
const { |
|
|
|
|
defaultLocalDisplayName, |
|
|
|
|
defaultRemoteDisplayName |
|
|
|
|
} = toState(stateful)['features/base/config']; |
|
|
|
|
} = state['features/base/config']; |
|
|
|
|
|
|
|
|
|
if (participant) { |
|
|
|
|
if (participant.isVirtualScreenshareParticipant) { |
|
|
|
|
return getScreenshareParticipantDisplayName(stateful, id); |
|
|
|
|
if (isScreenShareParticipant(participant)) { |
|
|
|
|
return getScreenshareParticipantDisplayName(state, id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (participant.name) { |
|
|
|
|
@ -546,7 +610,7 @@ export function shouldRenderParticipantVideo(stateful: IStateful, id: string) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* First check if we have an unmuted video track. */ |
|
|
|
|
const videoTrack = getVideoTrackByParticipant(state['features/base/tracks'], participant); |
|
|
|
|
const videoTrack = getVideoTrackByParticipant(state, participant); |
|
|
|
|
|
|
|
|
|
if (!shouldRenderVideoTrack(videoTrack, /* waitForVideoStarted */ false)) { |
|
|
|
|
return false; |
|
|
|
|
|