@azure/communication-react
Version:
React library for building modern communication user experiences utilizing Azure Communication Services
33 lines • 1.6 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* @private
*/
export class TogetherModeVideoStreamSubscriber {
constructor(callIdRef, stream, context) {
this.subscribe = () => {
this._togetherModeStream.on('isAvailableChanged', this.isAvailableChanged);
this._togetherModeStream.on('isReceivingChanged', this.isReceivingChanged);
this._togetherModeStream.on('sizeChanged', this.isSizeChanged);
};
this.unsubscribe = () => {
this._togetherModeStream.off('isAvailableChanged', this.isAvailableChanged);
this._togetherModeStream.off('isReceivingChanged', this.isReceivingChanged);
this._togetherModeStream.off('sizeChanged', this.isSizeChanged);
};
this.isAvailableChanged = () => {
this._context.setTogetherModeVideoStreamIsAvailable(this._callIdRef.callId, this._togetherModeStream.id, this._togetherModeStream.isAvailable);
};
this.isReceivingChanged = () => {
this._context.setTogetherModeVideoStreamIsReceiving(this._callIdRef.callId, this._togetherModeStream.id, this._togetherModeStream.isReceiving);
};
this.isSizeChanged = () => {
this._context.setTogetherModeVideoStreamSize(this._callIdRef.callId, this._togetherModeStream.id, this._togetherModeStream.size);
};
this._callIdRef = callIdRef;
this._togetherModeStream = stream;
this._context = context;
this.subscribe();
}
}
//# sourceMappingURL=TogetherModeVideoStreamSubscriber.js.map