UNPKG

@azure/communication-react

Version:

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

51 lines 2.48 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import { Features } from '@azure/communication-calling'; import { toFlatCommunicationIdentifier } from "../../acs-ui-common/src"; /** * @private */ export class PPTLiveSubscriber { constructor(callIdRef, context, call) { this.subscribe = () => { this._pptLive.on('isActiveChanged', this.isAvailableChanged); }; this.unsubscribe = () => { this._pptLive.off('isActiveChanged', this.isAvailableChanged); }; this.isAvailableChanged = () => { this._context.setCallPPTLiveActive(this._callIdRef.callId, this._pptLive.isActive); this.checkAndUpdatePPTLiveParticipant(); }; this.checkAndUpdatePPTLiveParticipant = () => __awaiter(this, void 0, void 0, function* () { if (!this._pptLive.activePresenterId) { return; } if (this._pptLive.isActive) { // TODO: need to refactor if Web Calling SDK has this logic ready if (this._call.isScreenSharingOn) { yield this._call.stopScreenSharing(); } this._context.setCallParticipantPPTLive(this._callIdRef.callId, toFlatCommunicationIdentifier(this._pptLive.activePresenterId), this._pptLive.target); } else { this._context.setCallParticipantPPTLive(this._callIdRef.callId, toFlatCommunicationIdentifier(this._pptLive.activePresenterId), undefined); } }); this._callIdRef = callIdRef; this._context = context; this._pptLive = call.feature(Features.PPTLive); this._call = call; this.subscribe(); } } //# sourceMappingURL=PPTLiveSubscriber.js.map