fix(external-api) Remove muted SS tracks from the list of participants currently screensharing.
Fixes an issue where 'contentSharingParticipantsChanged' event and 'getContentSharingParticipants' API continue to list IDs of the participants that have already stopped their screenshares.
This commit is contained in:
parent
2ba7b3acb7
commit
6ede5c478f
|
@ -35,6 +35,7 @@ import {
|
|||
LOCAL_PARTICIPANT_DEFAULT_ID,
|
||||
getLocalParticipant,
|
||||
getParticipantById,
|
||||
getScreenshareParticipantIds,
|
||||
grantModerator,
|
||||
hasRaisedHand,
|
||||
isLocalParticipantModerator,
|
||||
|
@ -855,8 +856,7 @@ function initCommands() {
|
|||
callback(Boolean(APP.store.getState()['features/base/config'].startSilent));
|
||||
break;
|
||||
case 'get-content-sharing-participants': {
|
||||
const tracks = getState()['features/base/tracks'];
|
||||
const sharingParticipantIds = tracks.filter(tr => tr.videoType === 'desktop').map(t => t.participantId);
|
||||
const sharingParticipantIds = getScreenshareParticipantIds(APP.store.getState());
|
||||
|
||||
callback({
|
||||
sharingParticipantIds
|
||||
|
|
|
@ -10,6 +10,7 @@ import { GRAVATAR_BASE_URL } from '../avatar/constants';
|
|||
import { isCORSAvatarURL } from '../avatar/functions';
|
||||
import { getMultipleVideoSupportFeatureFlag } from '../config/functions.any';
|
||||
import i18next from '../i18n/i18next';
|
||||
import { VIDEO_TYPE } from '../media/constants';
|
||||
import { toState } from '../redux/functions';
|
||||
import { getScreenShareTrack } from '../tracks/functions';
|
||||
import { createDeferred } from '../util/helpers';
|
||||
|
@ -458,6 +459,19 @@ export function getScreenshareParticipantDisplayName(stateful: IStateful, id: st
|
|||
return i18next.t('screenshareDisplayName', { name: ownerDisplayName });
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of IDs of the participants that are currently screensharing.
|
||||
*
|
||||
* @param {(Function|Object)} stateful - The (whole) redux state, or redux's {@code getState} function to be used to
|
||||
* retrieve the state.
|
||||
* @returns {Array<string>}
|
||||
*/
|
||||
export function getScreenshareParticipantIds(stateful: IStateful): Array<string> {
|
||||
return toState(stateful)['features/base/tracks']
|
||||
.filter(track => track.videoType === VIDEO_TYPE.DESKTOP && !track.muted)
|
||||
.map(t => t.participantId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the presence status of a participant associated with the passed id.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import _ from 'lodash';
|
||||
|
||||
import { getScreenshareParticipantIds } from '../participants/functions';
|
||||
import StateListenerRegistry from '../redux/StateListenerRegistry';
|
||||
|
||||
import { isLocalCameraTrackMuted } from './functions';
|
||||
|
@ -8,8 +9,7 @@ import { isLocalCameraTrackMuted } from './functions';
|
|||
* Notifies when the list of currently sharing participants changes.
|
||||
*/
|
||||
StateListenerRegistry.register(
|
||||
/* selector */ state =>
|
||||
state['features/base/tracks'].filter(tr => tr.videoType === 'desktop').map(t => t.participantId),
|
||||
/* selector */ state => getScreenshareParticipantIds(state),
|
||||
/* listener */ (participantIDs, store, previousParticipantIDs) => {
|
||||
if (typeof APP !== 'object') {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue