2021-01-12 09:13:20 +00:00
|
|
|
import _ from 'lodash';
|
|
|
|
|
2022-11-08 19:15:49 +00:00
|
|
|
import { MEDIA_TYPE } from '../media/constants';
|
2022-10-07 14:32:07 +00:00
|
|
|
import { getScreenshareParticipantIds } from '../participants/functions';
|
2022-09-23 07:48:20 +00:00
|
|
|
import StateListenerRegistry from '../redux/StateListenerRegistry';
|
2021-01-12 09:13:20 +00:00
|
|
|
|
2022-11-08 19:15:49 +00:00
|
|
|
import { isLocalTrackMuted } from './functions';
|
2021-05-04 12:57:34 +00:00
|
|
|
|
2021-01-12 09:13:20 +00:00
|
|
|
/**
|
|
|
|
* Notifies when the list of currently sharing participants changes.
|
|
|
|
*/
|
|
|
|
StateListenerRegistry.register(
|
2022-10-07 14:32:07 +00:00
|
|
|
/* selector */ state => getScreenshareParticipantIds(state),
|
2021-01-12 09:13:20 +00:00
|
|
|
/* listener */ (participantIDs, store, previousParticipantIDs) => {
|
|
|
|
if (typeof APP !== 'object') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_.isEqual(_.sortBy(participantIDs), _.sortBy(previousParticipantIDs))) {
|
|
|
|
APP.API.notifySharingParticipantsChanged(participantIDs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2021-05-04 12:57:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies when the local video mute state changes.
|
|
|
|
*/
|
|
|
|
StateListenerRegistry.register(
|
2022-11-08 19:15:49 +00:00
|
|
|
/* selector */ state => isLocalTrackMuted(state['features/base/tracks'], MEDIA_TYPE.VIDEO),
|
2021-05-04 12:57:34 +00:00
|
|
|
/* listener */ (muted, store, previousMuted) => {
|
|
|
|
if (typeof APP !== 'object') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (muted !== previousMuted) {
|
|
|
|
APP.API.notifyVideoMutedStatusChanged(muted);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|