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