UNPKG

@azure/communication-react

Version:

React library for building modern communication user experiences utilizing Azure Communication Services

46 lines 1.92 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. /** * @private */ export class ParticipantSubscriber { constructor(participant, emitter) { this.isMutedChangedHandler = () => { this.emitter.emit('isMutedChanged', { participantId: this.participant.identifier, isMuted: this.participant.isMuted }); }; this.displayNameChangedHandler = () => { this.emitter.emit('displayNameChanged', { participantId: this.participant.identifier, displayName: this.participant.displayName }); }; this.isSpeakingChangedHandler = () => { this.emitter.emit('isSpeakingChanged', { participantId: this.participant.identifier, isSpeaking: this.participant.isSpeaking }); }; this.videoStreamsUpdatedHandler = (event) => { this.emitter.emit('videoStreamsUpdated', event); }; this.participant = participant; this.emitter = emitter; this.subscribeParticipantEvents(); } subscribeParticipantEvents() { this.participant.on('isMutedChanged', this.isMutedChangedHandler); this.participant.on('displayNameChanged', this.displayNameChangedHandler); this.participant.on('isSpeakingChanged', this.isSpeakingChangedHandler); this.participant.on('videoStreamsUpdated', this.videoStreamsUpdatedHandler); } unsubscribeAll() { this.participant.off('isMutedChanged', this.isMutedChangedHandler); this.participant.off('displayNameChanged', this.displayNameChangedHandler); this.participant.off('isSpeakingChanged', this.isSpeakingChangedHandler); this.participant.off('videoStreamsUpdated', this.videoStreamsUpdatedHandler); } } //# sourceMappingURL=ParticipantSubcriber.js.map