Files
jitsi-meet/react/features/base/tracks/subscriber.js
hmuresan b998d80ee3 fix (external-api): fix notify video mute changed when presenting
- small refactor to trigger `notifyVideoMutedStatusChanged` correctly when participant is presenting
2021-05-04 18:23:32 +03:00

44 lines
1.1 KiB
JavaScript

// @flow
import _ from 'lodash';
import { StateListenerRegistry } from '../../base/redux';
import { isLocalCameraTrackMuted } from './functions';
declare var APP: Object;
/**
* 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),
/* listener */ (participantIDs, store, previousParticipantIDs) => {
if (typeof APP !== 'object') {
return;
}
if (!_.isEqual(_.sortBy(participantIDs), _.sortBy(previousParticipantIDs))) {
APP.API.notifySharingParticipantsChanged(participantIDs);
}
}
);
/**
* Notifies when the local video mute state changes.
*/
StateListenerRegistry.register(
/* selector */ state => isLocalCameraTrackMuted(state['features/base/tracks']),
/* listener */ (muted, store, previousMuted) => {
if (typeof APP !== 'object') {
return;
}
if (muted !== previousMuted) {
APP.API.notifyVideoMutedStatusChanged(muted);
}
}
);