UNPKG

communication-react-19

Version:

React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)

39 lines 1.96 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. /** * @private */ export class RecordingSubscriber { constructor(callIdRef, context, recording) { this.subscribe = () => { this._recording.on('isRecordingActiveChanged', this.isAvailableChanged); /* @conditional-compile-remove(local-recording-notification) */ this._recording.on('recordingsUpdated', this.isRecordingsUpdated); }; this.unsubscribe = () => { this._recording.off('isRecordingActiveChanged', this.isAvailableChanged); /* @conditional-compile-remove(local-recording-notification) */ this._recording.off('recordingsUpdated', this.isRecordingsUpdated); }; this.isAvailableChanged = () => { this._context.setCallRecordingActive(this._callIdRef.callId, this._recording.isRecordingActive); }; /* @conditional-compile-remove(local-recording-notification) */ this.isRecordingsUpdated = (data) => { this._context.setCallRecordingInfos(this._callIdRef.callId, this._recording.recordings, data.removed); }; this._callIdRef = callIdRef; this._context = context; this._recording = recording; // If recording as already started when we joined the call, make sure it is reflected in state as there may not // be an event for it. if (this._recording.isRecordingActive) { this._context.setCallRecordingActive(this._callIdRef.callId, this._recording.isRecordingActive); /* @conditional-compile-remove(local-recording-notification) */ // recordings getter only returns a list of active recordings, so we can set the list of recordings here this._context.setCallRecordingInfos(this._callIdRef.callId, this._recording.recordings, []); } this.subscribe(); } } //# sourceMappingURL=RecordingSubscriber.js.map