@webex/plugin-meetings 3.8.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -13
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/constants.js +32 -3
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/enums.js +1 -0
- package/dist/controls-options-manager/enums.js.map +1 -1
- package/dist/controls-options-manager/types.js.map +1 -1
- package/dist/controls-options-manager/util.js +26 -0
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/controlsUtils.js +11 -3
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +68 -84
- package/dist/locus-info/index.js.map +1 -1
- package/dist/media/index.js +2 -2
- package/dist/media/index.js.map +1 -1
- package/dist/meeting/brbState.js +17 -14
- package/dist/meeting/brbState.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +11 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +428 -253
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/request.js +19 -0
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/request.type.js.map +1 -1
- package/dist/{rtcMetrics/constants.js → meeting/type.js} +1 -5
- package/dist/meeting/type.js.map +1 -0
- package/dist/meeting/util.js +68 -2
- package/dist/meeting/util.js.map +1 -1
- package/dist/meetings/index.js +35 -33
- package/dist/meetings/index.js.map +1 -1
- package/dist/members/index.js +11 -9
- package/dist/members/index.js.map +1 -1
- package/dist/members/request.js +3 -3
- package/dist/members/request.js.map +1 -1
- package/dist/members/util.js +18 -6
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +1 -0
- package/dist/metrics/constants.js.map +1 -1
- package/dist/multistream/mediaRequestManager.js +1 -1
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/remoteMedia.js +34 -5
- package/dist/multistream/remoteMedia.js.map +1 -1
- package/dist/multistream/remoteMediaGroup.js +42 -2
- package/dist/multistream/remoteMediaGroup.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +32 -2
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/reachability/index.js +5 -10
- package/dist/reachability/index.js.map +1 -1
- package/dist/types/constants.d.ts +28 -0
- package/dist/types/controls-options-manager/enums.d.ts +2 -1
- package/dist/types/controls-options-manager/types.d.ts +4 -1
- package/dist/types/locus-info/index.d.ts +0 -9
- package/dist/types/meeting/brbState.d.ts +0 -1
- package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
- package/dist/types/meeting/index.d.ts +47 -19
- package/dist/types/meeting/request.d.ts +9 -1
- package/dist/types/meeting/request.type.d.ts +74 -0
- package/dist/types/meeting/type.d.ts +9 -0
- package/dist/types/meeting/util.d.ts +3 -0
- package/dist/types/members/index.d.ts +10 -7
- package/dist/types/members/request.d.ts +1 -1
- package/dist/types/members/util.d.ts +7 -3
- package/dist/types/metrics/constants.d.ts +1 -0
- package/dist/types/multistream/remoteMedia.d.ts +20 -1
- package/dist/types/multistream/remoteMediaGroup.d.ts +11 -0
- package/dist/types/multistream/sendSlotManager.d.ts +16 -0
- package/dist/types/reachability/index.d.ts +2 -2
- package/dist/webinar/index.js +1 -1
- package/package.json +24 -25
- package/src/constants.ts +32 -2
- package/src/controls-options-manager/enums.ts +1 -0
- package/src/controls-options-manager/types.ts +6 -1
- package/src/controls-options-manager/util.ts +31 -0
- package/src/locus-info/controlsUtils.ts +15 -0
- package/src/locus-info/index.ts +88 -82
- package/src/media/index.ts +2 -2
- package/src/meeting/brbState.ts +13 -9
- package/src/meeting/in-meeting-actions.ts +21 -0
- package/src/meeting/index.ts +254 -71
- package/src/meeting/request.ts +16 -0
- package/src/meeting/request.type.ts +64 -0
- package/src/meeting/type.ts +9 -0
- package/src/meeting/util.ts +73 -2
- package/src/meetings/index.ts +3 -2
- package/src/members/index.ts +13 -10
- package/src/members/request.ts +2 -2
- package/src/members/util.ts +16 -4
- package/src/metrics/constants.ts +1 -0
- package/src/multistream/mediaRequestManager.ts +7 -7
- package/src/multistream/remoteMedia.ts +34 -4
- package/src/multistream/remoteMediaGroup.ts +37 -2
- package/src/multistream/sendSlotManager.ts +34 -2
- package/src/reachability/index.ts +5 -13
- package/test/unit/spec/controls-options-manager/util.js +58 -0
- package/test/unit/spec/locus-info/controlsUtils.js +52 -0
- package/test/unit/spec/locus-info/index.js +218 -82
- package/test/unit/spec/media/index.ts +107 -0
- package/test/unit/spec/meeting/brbState.ts +23 -4
- package/test/unit/spec/meeting/in-meeting-actions.ts +10 -0
- package/test/unit/spec/meeting/index.js +901 -84
- package/test/unit/spec/meeting/request.js +71 -0
- package/test/unit/spec/meeting/utils.js +122 -1
- package/test/unit/spec/meetings/index.js +2 -0
- package/test/unit/spec/members/index.js +68 -9
- package/test/unit/spec/members/request.js +2 -2
- package/test/unit/spec/members/utils.js +27 -7
- package/test/unit/spec/multistream/mediaRequestManager.ts +19 -6
- package/test/unit/spec/multistream/remoteMedia.ts +66 -2
- package/test/unit/spec/multistream/sendSlotManager.ts +59 -0
- package/test/unit/spec/reachability/index.ts +2 -6
- package/dist/annotation/annotation.types.d.ts +0 -42
- package/dist/annotation/constants.d.ts +0 -31
- package/dist/annotation/index.d.ts +0 -117
- package/dist/breakouts/breakout.d.ts +0 -8
- package/dist/breakouts/collection.d.ts +0 -5
- package/dist/breakouts/edit-lock-error.d.ts +0 -15
- package/dist/breakouts/events.d.ts +0 -8
- package/dist/breakouts/index.d.ts +0 -5
- package/dist/breakouts/request.d.ts +0 -22
- package/dist/breakouts/utils.d.ts +0 -15
- package/dist/common/browser-detection.d.ts +0 -9
- package/dist/common/collection.d.ts +0 -48
- package/dist/common/config.d.ts +0 -2
- package/dist/common/errors/captcha-error.d.ts +0 -15
- package/dist/common/errors/intent-to-join.d.ts +0 -16
- package/dist/common/errors/join-meeting.d.ts +0 -17
- package/dist/common/errors/media.d.ts +0 -15
- package/dist/common/errors/no-meeting-info.d.ts +0 -14
- package/dist/common/errors/parameter.d.ts +0 -15
- package/dist/common/errors/password-error.d.ts +0 -15
- package/dist/common/errors/permission.d.ts +0 -14
- package/dist/common/errors/reclaim-host-role-error.d.ts +0 -60
- package/dist/common/errors/reclaim-host-role-error.js +0 -158
- package/dist/common/errors/reclaim-host-role-error.js.map +0 -1
- package/dist/common/errors/reclaim-host-role-errors.d.ts +0 -60
- package/dist/common/errors/reconnection-in-progress.d.ts +0 -9
- package/dist/common/errors/reconnection-in-progress.js +0 -35
- package/dist/common/errors/reconnection-in-progress.js.map +0 -1
- package/dist/common/errors/reconnection.d.ts +0 -15
- package/dist/common/errors/stats.d.ts +0 -15
- package/dist/common/errors/webex-errors.d.ts +0 -81
- package/dist/common/errors/webex-meetings-error.d.ts +0 -20
- package/dist/common/events/events-scope.d.ts +0 -17
- package/dist/common/events/events.d.ts +0 -12
- package/dist/common/events/trigger-proxy.d.ts +0 -2
- package/dist/common/events/util.d.ts +0 -2
- package/dist/common/logs/logger-config.d.ts +0 -2
- package/dist/common/logs/logger-proxy.d.ts +0 -2
- package/dist/common/logs/request.d.ts +0 -34
- package/dist/common/queue.d.ts +0 -32
- package/dist/config.d.ts +0 -73
- package/dist/constants.d.ts +0 -952
- package/dist/controls-options-manager/constants.d.ts +0 -4
- package/dist/controls-options-manager/enums.d.ts +0 -5
- package/dist/controls-options-manager/index.d.ts +0 -120
- package/dist/controls-options-manager/types.d.ts +0 -43
- package/dist/controls-options-manager/util.d.ts +0 -7
- package/dist/index.d.ts +0 -4
- package/dist/interceptors/index.d.ts +0 -2
- package/dist/interceptors/locusRetry.d.ts +0 -27
- package/dist/interpretation/collection.d.ts +0 -5
- package/dist/interpretation/index.d.ts +0 -5
- package/dist/interpretation/siLanguage.d.ts +0 -5
- package/dist/locus-info/controlsUtils.d.ts +0 -2
- package/dist/locus-info/embeddedAppsUtils.d.ts +0 -2
- package/dist/locus-info/fullState.d.ts +0 -2
- package/dist/locus-info/hostUtils.d.ts +0 -2
- package/dist/locus-info/index.d.ts +0 -269
- package/dist/locus-info/infoUtils.d.ts +0 -2
- package/dist/locus-info/mediaSharesUtils.d.ts +0 -2
- package/dist/locus-info/parser.d.ts +0 -212
- package/dist/locus-info/selfUtils.d.ts +0 -2
- package/dist/media/index.d.ts +0 -32
- package/dist/media/properties.d.ts +0 -108
- package/dist/media/util.d.ts +0 -2
- package/dist/mediaQualityMetrics/config.d.ts +0 -233
- package/dist/mediaQualityMetrics/config.js +0 -513
- package/dist/mediaQualityMetrics/config.js.map +0 -1
- package/dist/meeting/effectsState.d.ts +0 -42
- package/dist/meeting/effectsState.js +0 -260
- package/dist/meeting/effectsState.js.map +0 -1
- package/dist/meeting/in-meeting-actions.d.ts +0 -79
- package/dist/meeting/index.d.ts +0 -1622
- package/dist/meeting/locusMediaRequest.d.ts +0 -74
- package/dist/meeting/muteState.d.ts +0 -116
- package/dist/meeting/request.d.ts +0 -257
- package/dist/meeting/request.type.d.ts +0 -11
- package/dist/meeting/state.d.ts +0 -9
- package/dist/meeting/util.d.ts +0 -2
- package/dist/meeting/voicea-meeting.d.ts +0 -16
- package/dist/meeting-info/collection.d.ts +0 -20
- package/dist/meeting-info/index.d.ts +0 -57
- package/dist/meeting-info/meeting-info-v2.d.ts +0 -93
- package/dist/meeting-info/request.d.ts +0 -22
- package/dist/meeting-info/util.d.ts +0 -2
- package/dist/meeting-info/utilv2.d.ts +0 -2
- package/dist/meetings/collection.d.ts +0 -23
- package/dist/meetings/index.d.ts +0 -296
- package/dist/meetings/meetings.types.d.ts +0 -4
- package/dist/meetings/request.d.ts +0 -27
- package/dist/meetings/util.d.ts +0 -18
- package/dist/member/index.d.ts +0 -148
- package/dist/member/member.types.d.ts +0 -11
- package/dist/member/member.types.js +0 -18
- package/dist/member/member.types.js.map +0 -1
- package/dist/member/types.d.ts +0 -32
- package/dist/member/util.d.ts +0 -2
- package/dist/members/collection.d.ts +0 -24
- package/dist/members/index.d.ts +0 -308
- package/dist/members/request.d.ts +0 -58
- package/dist/members/types.d.ts +0 -25
- package/dist/members/util.d.ts +0 -2
- package/dist/metrics/config.d.ts +0 -169
- package/dist/metrics/config.js +0 -289
- package/dist/metrics/config.js.map +0 -1
- package/dist/metrics/constants.d.ts +0 -59
- package/dist/metrics/index.d.ts +0 -152
- package/dist/multistream/mediaRequestManager.d.ts +0 -119
- package/dist/multistream/receiveSlot.d.ts +0 -68
- package/dist/multistream/receiveSlotManager.d.ts +0 -56
- package/dist/multistream/remoteMedia.d.ts +0 -72
- package/dist/multistream/remoteMediaGroup.d.ts +0 -49
- package/dist/multistream/remoteMediaManager.d.ts +0 -300
- package/dist/multistream/sendSlotManager.d.ts +0 -69
- package/dist/networkQualityMonitor/index.d.ts +0 -70
- package/dist/networkQualityMonitor/index.js +0 -226
- package/dist/networkQualityMonitor/index.js.map +0 -1
- package/dist/peer-connection-manager/index.d.ts +0 -6
- package/dist/peer-connection-manager/index.js +0 -671
- package/dist/peer-connection-manager/index.js.map +0 -1
- package/dist/peer-connection-manager/util.d.ts +0 -6
- package/dist/peer-connection-manager/util.js +0 -110
- package/dist/peer-connection-manager/util.js.map +0 -1
- package/dist/personal-meeting-room/index.d.ts +0 -47
- package/dist/personal-meeting-room/request.d.ts +0 -14
- package/dist/personal-meeting-room/util.d.ts +0 -2
- package/dist/reachability/clusterReachability.d.ts +0 -109
- package/dist/reachability/index.d.ts +0 -139
- package/dist/reachability/request.d.ts +0 -35
- package/dist/reachability/util.d.ts +0 -8
- package/dist/reactions/constants.d.ts +0 -3
- package/dist/reactions/reactions.d.ts +0 -4
- package/dist/reactions/reactions.type.d.ts +0 -32
- package/dist/reconnection-manager/index.d.ts +0 -112
- package/dist/recording-controller/enums.d.ts +0 -7
- package/dist/recording-controller/index.d.ts +0 -193
- package/dist/recording-controller/util.d.ts +0 -13
- package/dist/roap/collection.d.ts +0 -10
- package/dist/roap/collection.js +0 -63
- package/dist/roap/collection.js.map +0 -1
- package/dist/roap/handler.d.ts +0 -47
- package/dist/roap/handler.js +0 -279
- package/dist/roap/handler.js.map +0 -1
- package/dist/roap/index.d.ts +0 -116
- package/dist/roap/request.d.ts +0 -35
- package/dist/roap/state.d.ts +0 -9
- package/dist/roap/state.js +0 -127
- package/dist/roap/state.js.map +0 -1
- package/dist/roap/turnDiscovery.d.ts +0 -81
- package/dist/roap/util.d.ts +0 -2
- package/dist/roap/util.js +0 -76
- package/dist/roap/util.js.map +0 -1
- package/dist/rtcMetrics/constants.d.ts +0 -4
- package/dist/rtcMetrics/constants.js.map +0 -1
- package/dist/rtcMetrics/index.d.ts +0 -61
- package/dist/rtcMetrics/index.js +0 -197
- package/dist/rtcMetrics/index.js.map +0 -1
- package/dist/statsAnalyzer/global.d.ts +0 -118
- package/dist/statsAnalyzer/global.js +0 -127
- package/dist/statsAnalyzer/global.js.map +0 -1
- package/dist/statsAnalyzer/index.d.ts +0 -193
- package/dist/statsAnalyzer/index.js +0 -1019
- package/dist/statsAnalyzer/index.js.map +0 -1
- package/dist/statsAnalyzer/mqaUtil.d.ts +0 -22
- package/dist/statsAnalyzer/mqaUtil.js +0 -181
- package/dist/statsAnalyzer/mqaUtil.js.map +0 -1
- package/dist/transcription/index.d.ts +0 -64
- package/dist/types/common/errors/reconnection-in-progress.d.ts +0 -9
- package/dist/types/mediaQualityMetrics/config.d.ts +0 -241
- package/dist/types/networkQualityMonitor/index.d.ts +0 -70
- package/dist/types/rtcMetrics/constants.d.ts +0 -4
- package/dist/types/rtcMetrics/index.d.ts +0 -71
- package/dist/types/statsAnalyzer/global.d.ts +0 -36
- package/dist/types/statsAnalyzer/index.d.ts +0 -217
- package/dist/types/statsAnalyzer/mqaUtil.d.ts +0 -48
- package/dist/webinar/collection.d.ts +0 -16
- package/dist/webinar/index.d.ts +0 -5
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_lodash","require","_loggerProxy","_interopRequireDefault","_remoteMedia","RemoteMediaGroup","exports","mediaRequestManager","receiveSlots","priority","commitMediaRequest","_this","options","arguments","length","undefined","_classCallCheck2","default","_defineProperty2","unpinnedRemoteMedia","map","slot","RemoteMedia","resolution","pinnedRemoteMedia","sendActiveSpeakerMediaRequest","_createClass2","key","value","getRemoteMedia","filter","_toConsumableArray2","concat","setActiveSpeakerCsis","remoteMediaCsis","_this2","commit","forEach","_ref","csi","remoteMedia","indexOf","unpinId","splice","push","Error","id","sendMediaRequest","pinId","cancelMediaRequest","cancelActiveSpeakerMediaRequest","pin","targetCsi","LoggerProxy","logger","log","idx","unpin","isPinned","setPreferLiveVideo","preferLiveVideo","_this$options","_this$options$namedMe","_this$options2","mediaRequestId","addRequest","policyInfo","policy","crossPriorityDuplication","crossPolicyDuplication","namedMediaGroups","namedMediaGroup","getUnderlyingReceiveSlot","codecInfo","codec","maxFs","getMaxFs","cancelRequest","setNamedMediaGroup","type","stop","includes"],"sources":["remoteMediaGroup.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\n/* eslint-disable require-jsdoc */\n/* eslint-disable import/prefer-default-export */\nimport {forEach} from 'lodash';\nimport {NamedMediaGroup} from '@webex/internal-media-core';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nimport {getMaxFs, RemoteMedia, RemoteVideoResolution} from './remoteMedia';\nimport {MediaRequestId, MediaRequestManager} from './mediaRequestManager';\nimport {CSI, ReceiveSlot} from './receiveSlot';\n\ntype Options = {\n resolution?: RemoteVideoResolution; // applies only to groups of type MediaType.VideoMain and MediaType.VideoSlides\n preferLiveVideo?: boolean; // applies only to groups of type MediaType.VideoMain and MediaType.VideoSlides\n namedMediaGroup?: NamedMediaGroup; // applies only to named media groups for audio\n};\n\nexport class RemoteMediaGroup {\n private mediaRequestManager: MediaRequestManager;\n\n private priority: number;\n\n private options: Options;\n\n private unpinnedRemoteMedia: RemoteMedia[];\n\n private mediaRequestId?: MediaRequestId; // id of the \"active-speaker\" media request id\n\n private pinnedRemoteMedia: RemoteMedia[];\n\n constructor(\n mediaRequestManager: MediaRequestManager,\n receiveSlots: ReceiveSlot[],\n priority: number,\n commitMediaRequest: boolean,\n options: Options = {}\n ) {\n this.mediaRequestManager = mediaRequestManager;\n this.priority = priority;\n this.options = options;\n\n this.unpinnedRemoteMedia = receiveSlots.map(\n (slot) =>\n new RemoteMedia(slot, this.mediaRequestManager, {\n resolution: this.options.resolution,\n })\n );\n this.pinnedRemoteMedia = [];\n\n this.sendActiveSpeakerMediaRequest(commitMediaRequest);\n }\n\n /**\n * Gets the array of remote media elements from the group\n *\n * @param {string} filter - 'all' (default) returns both pinned and unpinned\n * @returns {Array<RemoteMedia>}\n */\n public getRemoteMedia(filter: 'all' | 'pinned' | 'unpinned' = 'all') {\n if (filter === 'unpinned') {\n // return a shallow copy so that the client cannot modify this.unpinnedRemoteMedia array\n return [...this.unpinnedRemoteMedia];\n }\n if (filter === 'pinned') {\n // return a shallow copy so that the client cannot modify this.pinnedRemoteMedia array\n return [...this.pinnedRemoteMedia];\n }\n\n return [...this.unpinnedRemoteMedia, ...this.pinnedRemoteMedia];\n }\n\n /**\n * Sets CSIs for multiple RemoteMedia instances belonging to this RemoteMediaGroup.\n * For each entry in the remoteMediaCsis array:\n * - if csi is specified, the RemoteMedia instance is pinned to that CSI\n * - if csi is undefined, the RemoteMedia instance is unpinned\n * @internal\n */\n public setActiveSpeakerCsis(\n remoteMediaCsis: {remoteMedia: RemoteMedia; csi?: number}[],\n commit = true\n ): void {\n forEach(remoteMediaCsis, ({csi, remoteMedia}) => {\n if (csi) {\n if (!(this.pinnedRemoteMedia.indexOf(remoteMedia) >= 0)) {\n const unpinId = this.unpinnedRemoteMedia.indexOf(remoteMedia);\n if (unpinId >= 0) {\n this.unpinnedRemoteMedia.splice(unpinId, 1);\n this.pinnedRemoteMedia.push(remoteMedia);\n } else {\n throw new Error(\n `failed to pin a remote media object ${remoteMedia.id}, because it is not found in this remote media group`\n );\n }\n }\n remoteMedia.sendMediaRequest(csi, false);\n } else {\n if (!(this.unpinnedRemoteMedia.indexOf(remoteMedia) >= 0)) {\n const pinId = this.pinnedRemoteMedia.indexOf(remoteMedia);\n if (pinId >= 0) {\n this.pinnedRemoteMedia.splice(pinId, 1);\n this.unpinnedRemoteMedia.push(remoteMedia);\n } else {\n throw new Error(\n `failed to unpin a remote media object ${remoteMedia.id}, because it is not found in this remote media group`\n );\n }\n }\n remoteMedia.cancelMediaRequest(false);\n }\n });\n this.cancelActiveSpeakerMediaRequest(false);\n this.sendActiveSpeakerMediaRequest(false);\n if (commit) {\n this.mediaRequestManager.commit();\n }\n }\n\n /**\n * Pins a specific remote media instance to a specfic CSI, so the media will\n * no longer come from active speaker, but from that CSI.\n * If no CSI is given, the current CSI value is used.\n *\n */\n public pin(remoteMedia: RemoteMedia, csi?: CSI): void {\n // if csi is not specified, use the current one\n const targetCsi = csi || remoteMedia.csi;\n\n if (!targetCsi) {\n throw new Error(\n `failed to pin a remote media object ${remoteMedia.id}, because it has no CSI set and no CSI value was given`\n );\n }\n\n if (this.pinnedRemoteMedia.indexOf(remoteMedia) >= 0) {\n if (targetCsi === remoteMedia.csi) {\n // remote media already pinned to target CSI, nothing to do\n LoggerProxy.logger.log(\n `RemoteMediaGroup#pin --> remote media ${remoteMedia.id} already pinned`\n );\n\n return;\n }\n } else {\n const idx = this.unpinnedRemoteMedia.indexOf(remoteMedia);\n\n if (idx < 0) {\n throw new Error(\n `failed to pin a remote media object ${remoteMedia.id}, because it is not found in this remote media group`\n );\n }\n\n this.unpinnedRemoteMedia.splice(idx, 1);\n this.pinnedRemoteMedia.push(remoteMedia);\n\n this.cancelActiveSpeakerMediaRequest(false);\n this.sendActiveSpeakerMediaRequest(false);\n }\n\n remoteMedia.sendMediaRequest(targetCsi, false);\n this.mediaRequestManager.commit();\n }\n\n /**\n * Unpins a remote media instance, so that it will again provide media from active speakers\n *\n */\n public unpin(remoteMedia: RemoteMedia) {\n if (this.unpinnedRemoteMedia.indexOf(remoteMedia) >= 0) {\n LoggerProxy.logger.log(\n `RemoteMediaGroup#pin --> remote media ${remoteMedia.id} already unpinned`\n );\n\n return;\n }\n const idx = this.pinnedRemoteMedia.indexOf(remoteMedia);\n\n if (idx < 0) {\n throw new Error(\n `failed to unpin a remote media object ${remoteMedia.id}, because it is not found in this remote media group`\n );\n }\n\n this.pinnedRemoteMedia.splice(idx, 1);\n this.unpinnedRemoteMedia.push(remoteMedia);\n\n remoteMedia.cancelMediaRequest(false);\n this.cancelActiveSpeakerMediaRequest(false);\n this.sendActiveSpeakerMediaRequest(false);\n this.mediaRequestManager.commit();\n }\n\n public isPinned(remoteMedia: RemoteMedia) {\n if (this.unpinnedRemoteMedia.indexOf(remoteMedia) >= 0) {\n return false;\n }\n if (this.pinnedRemoteMedia.indexOf(remoteMedia) >= 0) {\n return true;\n }\n\n throw new Error(`remote media object ${remoteMedia.id} not found in the group`);\n }\n\n /**\n * setPreferLiveVideo - sets preferLiveVideo to true/false\n * @internal\n */\n public setPreferLiveVideo(preferLiveVideo: boolean, commit: boolean) {\n if (this.options.preferLiveVideo !== preferLiveVideo) {\n this.options.preferLiveVideo = preferLiveVideo;\n this.sendActiveSpeakerMediaRequest(commit);\n }\n }\n\n private sendActiveSpeakerMediaRequest(commit: boolean) {\n this.cancelActiveSpeakerMediaRequest(false);\n\n this.mediaRequestId = this.mediaRequestManager.addRequest(\n {\n policyInfo: {\n policy: 'active-speaker',\n priority: this.priority,\n crossPriorityDuplication: false,\n crossPolicyDuplication: false,\n preferLiveVideo: !!this.options?.preferLiveVideo,\n namedMediaGroups: this.options.namedMediaGroup?.value\n ? [this.options?.namedMediaGroup]\n : undefined,\n },\n receiveSlots: this.unpinnedRemoteMedia.map((remoteMedia) =>\n remoteMedia.getUnderlyingReceiveSlot()\n ) as ReceiveSlot[],\n codecInfo: this.options.resolution && {\n codec: 'h264',\n maxFs: getMaxFs(this.options.resolution),\n },\n },\n commit\n );\n }\n\n private cancelActiveSpeakerMediaRequest(commit: boolean) {\n if (this.mediaRequestId) {\n this.mediaRequestManager.cancelRequest(this.mediaRequestId, commit);\n this.mediaRequestId = undefined;\n }\n }\n\n /**\n * setNamedMediaGroup - sets named media group type and value\n * @internal\n */\n public setNamedMediaGroup(namedMediaGroup: NamedMediaGroup, commit: boolean) {\n if (\n this.options.namedMediaGroup.value !== namedMediaGroup.value ||\n this.options.namedMediaGroup.type !== namedMediaGroup.type\n ) {\n this.options.namedMediaGroup = namedMediaGroup;\n this.sendActiveSpeakerMediaRequest(commit);\n }\n }\n\n /**\n * Invalidates the remote media group by clearing the references to the receive slots\n * used by all remote media from that group and cancelling all media requests.\n * After this call the remote media group is unusable.\n *\n * @param{boolean} commit whether to commit the cancellation of media requests\n * @internal\n */\n public stop(commit = true) {\n this.unpinnedRemoteMedia.forEach((remoteMedia) => remoteMedia.stop(false));\n this.pinnedRemoteMedia.forEach((remoteMedia) => remoteMedia.stop(false));\n this.cancelActiveSpeakerMediaRequest(false);\n\n if (commit) {\n this.mediaRequestManager.commit();\n }\n }\n\n /**\n * Checks if a given RemoteMedia instance belongs to this group.\n *\n * @param remoteMedia RemoteMedia instance to check\n * @param filter controls which remote media from the group to check\n * @returns true if remote media is found\n */\n public includes(\n remoteMedia: RemoteMedia,\n filter: 'all' | 'pinned' | 'unpinned' = 'all'\n ): boolean {\n if (filter === 'pinned') {\n return this.pinnedRemoteMedia.includes(remoteMedia);\n }\n if (filter === 'unpinned') {\n return this.unpinnedRemoteMedia.includes(remoteMedia);\n }\n\n return (\n this.unpinnedRemoteMedia.includes(remoteMedia) || this.pinnedRemoteMedia.includes(remoteMedia)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AAPA;AACA;AACA;AAAA,IAeaI,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA;EAa3B,SAAAA,iBACEE,mBAAwC,EACxCC,YAA2B,EAC3BC,QAAgB,EAChBC,kBAA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AAAvB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;MACvB,IAAI,CAACM,mBAAmB,CAACkB,OAAO,CAAC,UAACG,WAAW;QAAA,OAAKA,WAAW,CAACwC,IAAI,CAAC,KAAK,CAAC;MAAA,EAAC;MAC1E,IAAI,CAACxD,iBAAiB,CAACa,OAAO,CAAC,UAACG,WAAW;QAAA,OAAKA,WAAW,CAACwC,IAAI,CAAC,KAAK,CAAC;MAAA,EAAC;MACxE,IAAI,CAAC9B,+BAA+B,CAAC,KAAK,CAAC;MAE3C,IAAId,MAAM,EAAE;QACV,IAAI,CAAC7B,mBAAmB,CAAC6B,MAAM,CAAC,CAAC;MACnC;IACF;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE;IAAAT,GAAA;IAAAC,KAAA,EAOA,SAAAqD,SACEzC,WAAwB,EAEf;MAAA,IADTV,MAAqC,GAAAjB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;MAE7C,IAAIiB,MAAM,KAAK,QAAQ,EAAE;QACvB,OAAO,IAAI,CAACN,iBAAiB,CAACyD,QAAQ,CAACzC,WAAW,CAAC;MACrD;MACA,IAAIV,MAAM,KAAK,UAAU,EAAE;QACzB,OAAO,IAAI,CAACX,mBAAmB,CAAC8D,QAAQ,CAACzC,WAAW,CAAC;MACvD;MAEA,OACE,IAAI,CAACrB,mBAAmB,CAAC8D,QAAQ,CAACzC,WAAW,CAAC,IAAI,IAAI,CAAChB,iBAAiB,CAACyD,QAAQ,CAACzC,WAAW,CAAC;IAElG;EAAC;EAAA,OAAAnC,gBAAA;AAAA"}
|
1
|
+
{"version":3,"names":["_lodash","require","_loggerProxy","_interopRequireDefault","_remoteMedia","RemoteMediaGroup","exports","mediaRequestManager","receiveSlots","priority","commitMediaRequest","_this","options","arguments","length","undefined","_classCallCheck2","default","_defineProperty2","unpinnedRemoteMedia","map","slot","RemoteMedia","resolution","pinnedRemoteMedia","sendActiveSpeakerMediaRequest","_createClass2","key","value","getRemoteMedia","filter","_toConsumableArray2","concat","setActiveSpeakerCsis","remoteMediaCsis","_this2","commit","forEach","_ref","csi","remoteMedia","indexOf","unpinId","splice","push","Error","id","sendMediaRequest","pinId","cancelMediaRequest","cancelActiveSpeakerMediaRequest","pin","targetCsi","LoggerProxy","logger","log","idx","unpin","isPinned","setPreferLiveVideo","preferLiveVideo","_this$options","_this$options$namedMe","_this$options2","effectiveMaxFs","getEffectiveMaxFsForActiveSpeaker","mediaRequestId","addRequest","policyInfo","policy","crossPriorityDuplication","crossPolicyDuplication","namedMediaGroups","namedMediaGroup","getUnderlyingReceiveSlot","codecInfo","codec","maxFs","cancelRequest","setNamedMediaGroup","type","stop","includes","maxFsValues","getEffectiveMaxFs","Math","max","apply","getMaxFs"],"sources":["remoteMediaGroup.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\n/* eslint-disable require-jsdoc */\n/* eslint-disable import/prefer-default-export */\nimport {forEach} from 'lodash';\nimport {NamedMediaGroup} from '@webex/internal-media-core';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nimport {getMaxFs, RemoteMedia, RemoteVideoResolution} from './remoteMedia';\nimport {MediaRequestId, MediaRequestManager} from './mediaRequestManager';\nimport {CSI, ReceiveSlot} from './receiveSlot';\n\ntype Options = {\n resolution?: RemoteVideoResolution; // applies only to groups of type MediaType.VideoMain and MediaType.VideoSlides\n preferLiveVideo?: boolean; // applies only to groups of type MediaType.VideoMain and MediaType.VideoSlides\n namedMediaGroup?: NamedMediaGroup; // applies only to named media groups for audio\n};\n\nexport class RemoteMediaGroup {\n private mediaRequestManager: MediaRequestManager;\n\n private priority: number;\n\n private options: Options;\n\n private unpinnedRemoteMedia: RemoteMedia[];\n\n private mediaRequestId?: MediaRequestId; // id of the \"active-speaker\" media request id\n\n private pinnedRemoteMedia: RemoteMedia[];\n\n constructor(\n mediaRequestManager: MediaRequestManager,\n receiveSlots: ReceiveSlot[],\n priority: number,\n commitMediaRequest: boolean,\n options: Options = {}\n ) {\n this.mediaRequestManager = mediaRequestManager;\n this.priority = priority;\n this.options = options;\n\n this.unpinnedRemoteMedia = receiveSlots.map(\n (slot) =>\n new RemoteMedia(slot, this.mediaRequestManager, {\n resolution: this.options.resolution,\n })\n );\n this.pinnedRemoteMedia = [];\n\n this.sendActiveSpeakerMediaRequest(commitMediaRequest);\n }\n\n /**\n * Gets the array of remote media elements from the group\n *\n * @param {string} filter - 'all' (default) returns both pinned and unpinned\n * @returns {Array<RemoteMedia>}\n */\n public getRemoteMedia(filter: 'all' | 'pinned' | 'unpinned' = 'all') {\n if (filter === 'unpinned') {\n // return a shallow copy so that the client cannot modify this.unpinnedRemoteMedia array\n return [...this.unpinnedRemoteMedia];\n }\n if (filter === 'pinned') {\n // return a shallow copy so that the client cannot modify this.pinnedRemoteMedia array\n return [...this.pinnedRemoteMedia];\n }\n\n return [...this.unpinnedRemoteMedia, ...this.pinnedRemoteMedia];\n }\n\n /**\n * Sets CSIs for multiple RemoteMedia instances belonging to this RemoteMediaGroup.\n * For each entry in the remoteMediaCsis array:\n * - if csi is specified, the RemoteMedia instance is pinned to that CSI\n * - if csi is undefined, the RemoteMedia instance is unpinned\n * @internal\n */\n public setActiveSpeakerCsis(\n remoteMediaCsis: {remoteMedia: RemoteMedia; csi?: number}[],\n commit = true\n ): void {\n forEach(remoteMediaCsis, ({csi, remoteMedia}) => {\n if (csi) {\n if (!(this.pinnedRemoteMedia.indexOf(remoteMedia) >= 0)) {\n const unpinId = this.unpinnedRemoteMedia.indexOf(remoteMedia);\n if (unpinId >= 0) {\n this.unpinnedRemoteMedia.splice(unpinId, 1);\n this.pinnedRemoteMedia.push(remoteMedia);\n } else {\n throw new Error(\n `failed to pin a remote media object ${remoteMedia.id}, because it is not found in this remote media group`\n );\n }\n }\n remoteMedia.sendMediaRequest(csi, false);\n } else {\n if (!(this.unpinnedRemoteMedia.indexOf(remoteMedia) >= 0)) {\n const pinId = this.pinnedRemoteMedia.indexOf(remoteMedia);\n if (pinId >= 0) {\n this.pinnedRemoteMedia.splice(pinId, 1);\n this.unpinnedRemoteMedia.push(remoteMedia);\n } else {\n throw new Error(\n `failed to unpin a remote media object ${remoteMedia.id}, because it is not found in this remote media group`\n );\n }\n }\n remoteMedia.cancelMediaRequest(false);\n }\n });\n this.cancelActiveSpeakerMediaRequest(false);\n this.sendActiveSpeakerMediaRequest(false);\n if (commit) {\n this.mediaRequestManager.commit();\n }\n }\n\n /**\n * Pins a specific remote media instance to a specfic CSI, so the media will\n * no longer come from active speaker, but from that CSI.\n * If no CSI is given, the current CSI value is used.\n *\n */\n public pin(remoteMedia: RemoteMedia, csi?: CSI): void {\n // if csi is not specified, use the current one\n const targetCsi = csi || remoteMedia.csi;\n\n if (!targetCsi) {\n throw new Error(\n `failed to pin a remote media object ${remoteMedia.id}, because it has no CSI set and no CSI value was given`\n );\n }\n\n if (this.pinnedRemoteMedia.indexOf(remoteMedia) >= 0) {\n if (targetCsi === remoteMedia.csi) {\n // remote media already pinned to target CSI, nothing to do\n LoggerProxy.logger.log(\n `RemoteMediaGroup#pin --> remote media ${remoteMedia.id} already pinned`\n );\n\n return;\n }\n } else {\n const idx = this.unpinnedRemoteMedia.indexOf(remoteMedia);\n\n if (idx < 0) {\n throw new Error(\n `failed to pin a remote media object ${remoteMedia.id}, because it is not found in this remote media group`\n );\n }\n\n this.unpinnedRemoteMedia.splice(idx, 1);\n this.pinnedRemoteMedia.push(remoteMedia);\n\n this.cancelActiveSpeakerMediaRequest(false);\n this.sendActiveSpeakerMediaRequest(false);\n }\n\n remoteMedia.sendMediaRequest(targetCsi, false);\n this.mediaRequestManager.commit();\n }\n\n /**\n * Unpins a remote media instance, so that it will again provide media from active speakers\n *\n */\n public unpin(remoteMedia: RemoteMedia) {\n if (this.unpinnedRemoteMedia.indexOf(remoteMedia) >= 0) {\n LoggerProxy.logger.log(\n `RemoteMediaGroup#pin --> remote media ${remoteMedia.id} already unpinned`\n );\n\n return;\n }\n const idx = this.pinnedRemoteMedia.indexOf(remoteMedia);\n\n if (idx < 0) {\n throw new Error(\n `failed to unpin a remote media object ${remoteMedia.id}, because it is not found in this remote media group`\n );\n }\n\n this.pinnedRemoteMedia.splice(idx, 1);\n this.unpinnedRemoteMedia.push(remoteMedia);\n\n remoteMedia.cancelMediaRequest(false);\n this.cancelActiveSpeakerMediaRequest(false);\n this.sendActiveSpeakerMediaRequest(false);\n this.mediaRequestManager.commit();\n }\n\n public isPinned(remoteMedia: RemoteMedia) {\n if (this.unpinnedRemoteMedia.indexOf(remoteMedia) >= 0) {\n return false;\n }\n if (this.pinnedRemoteMedia.indexOf(remoteMedia) >= 0) {\n return true;\n }\n\n throw new Error(`remote media object ${remoteMedia.id} not found in the group`);\n }\n\n /**\n * setPreferLiveVideo - sets preferLiveVideo to true/false\n * @internal\n */\n public setPreferLiveVideo(preferLiveVideo: boolean, commit: boolean) {\n if (this.options.preferLiveVideo !== preferLiveVideo) {\n this.options.preferLiveVideo = preferLiveVideo;\n this.sendActiveSpeakerMediaRequest(commit);\n }\n }\n\n private sendActiveSpeakerMediaRequest(commit: boolean) {\n this.cancelActiveSpeakerMediaRequest(false);\n\n // Calculate the effective maxFs based on all unpinned RemoteMedia instances\n const effectiveMaxFs = this.getEffectiveMaxFsForActiveSpeaker();\n\n this.mediaRequestId = this.mediaRequestManager.addRequest(\n {\n policyInfo: {\n policy: 'active-speaker',\n priority: this.priority,\n crossPriorityDuplication: false,\n crossPolicyDuplication: false,\n preferLiveVideo: !!this.options?.preferLiveVideo,\n namedMediaGroups: this.options.namedMediaGroup?.value\n ? [this.options?.namedMediaGroup]\n : undefined,\n },\n receiveSlots: this.unpinnedRemoteMedia.map((remoteMedia) =>\n remoteMedia.getUnderlyingReceiveSlot()\n ) as ReceiveSlot[],\n codecInfo: effectiveMaxFs && {\n codec: 'h264',\n maxFs: effectiveMaxFs,\n },\n },\n commit\n );\n }\n\n private cancelActiveSpeakerMediaRequest(commit: boolean) {\n if (this.mediaRequestId) {\n this.mediaRequestManager.cancelRequest(this.mediaRequestId, commit);\n this.mediaRequestId = undefined;\n }\n }\n\n /**\n * setNamedMediaGroup - sets named media group type and value\n * @internal\n */\n public setNamedMediaGroup(namedMediaGroup: NamedMediaGroup, commit: boolean) {\n if (\n this.options.namedMediaGroup.value !== namedMediaGroup.value ||\n this.options.namedMediaGroup.type !== namedMediaGroup.type\n ) {\n this.options.namedMediaGroup = namedMediaGroup;\n this.sendActiveSpeakerMediaRequest(commit);\n }\n }\n\n /**\n * Invalidates the remote media group by clearing the references to the receive slots\n * used by all remote media from that group and cancelling all media requests.\n * After this call the remote media group is unusable.\n *\n * @param{boolean} commit whether to commit the cancellation of media requests\n * @internal\n */\n public stop(commit = true) {\n this.unpinnedRemoteMedia.forEach((remoteMedia) => remoteMedia.stop(false));\n this.pinnedRemoteMedia.forEach((remoteMedia) => remoteMedia.stop(false));\n this.cancelActiveSpeakerMediaRequest(false);\n\n if (commit) {\n this.mediaRequestManager.commit();\n }\n }\n\n /**\n * Checks if a given RemoteMedia instance belongs to this group.\n *\n * @param remoteMedia RemoteMedia instance to check\n * @param filter controls which remote media from the group to check\n * @returns true if remote media is found\n */\n public includes(\n remoteMedia: RemoteMedia,\n filter: 'all' | 'pinned' | 'unpinned' = 'all'\n ): boolean {\n if (filter === 'pinned') {\n return this.pinnedRemoteMedia.includes(remoteMedia);\n }\n if (filter === 'unpinned') {\n return this.unpinnedRemoteMedia.includes(remoteMedia);\n }\n\n return (\n this.unpinnedRemoteMedia.includes(remoteMedia) || this.pinnedRemoteMedia.includes(remoteMedia)\n );\n }\n\n /**\n * Calculate the effective maxFs for the active speaker media request based on unpinned RemoteMedia instances\n * @returns {number | undefined} The calculated maxFs value, or undefined if no constraints\n * @private\n */\n private getEffectiveMaxFsForActiveSpeaker(): number | undefined {\n // Get all effective maxFs values from unpinned RemoteMedia instances\n const maxFsValues = this.unpinnedRemoteMedia\n .map((remoteMedia) => remoteMedia.getEffectiveMaxFs())\n .filter((maxFs) => maxFs !== undefined);\n\n // Use the highest maxFs value to ensure we don't under-request resolution for any instance\n if (maxFsValues.length > 0) {\n return Math.max(...maxFsValues);\n }\n\n // Fall back to group's resolution option\n if (this.options.resolution) {\n return getMaxFs(this.options.resolution);\n }\n\n return undefined;\n }\n\n /**\n * Get the current effective maxFs that would be used for the active speaker media request\n * @returns {number | undefined} The effective maxFs value\n */\n public getEffectiveMaxFs(): number | undefined {\n return this.getEffectiveMaxFsForActiveSpeaker();\n }\n}\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AAPA;AACA;AACA;AAAA,IAeaI,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA;EAa3B,SAAAA,iBACEE,mBAAwC,EACxCC,YAA2B,EAC3BC,QAAgB,EAChBC,kBAA2B,EAE3B;IAAA,IAAAC,KAAA;IAAA,IADAC,OAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAA,IAAAG,gBAAA,CAAAC,OAAA,QAAAZ,gBAAA;IAAA,IAAAa,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IATkB;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAWvC,IAAI,CAACV,mBAAmB,GAAGA,mBAAmB;IAC9C,IAAI,CAACE,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACG,OAAO,GAAGA,OAAO;IAEtB,IAAI,CAACO,mBAAmB,GAAGX,YAAY,CAACY,GAAG,CACzC,UAACC,IAAI;MAAA,OACH,IAAIC,wBAAW,CAACD,IAAI,EAAEV,KAAI,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_interopRequireDefault(require("@babel/runtime-corejs2/he
|
|
13
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
15
15
|
var _internalMediaCore = require("@webex/internal-media-core");
|
16
|
+
/**
|
17
|
+
* This class is used to manage the sendSlots for the given media types.
|
18
|
+
*/
|
16
19
|
var SendSlotManager = exports.default = /*#__PURE__*/function () {
|
20
|
+
/**
|
21
|
+
* Constructor for SendSlotManager
|
22
|
+
*
|
23
|
+
* @param {any} LoggerProxy is used to log the messages
|
24
|
+
* @constructor
|
25
|
+
*/
|
17
26
|
function SendSlotManager(LoggerProxy) {
|
18
27
|
(0, _classCallCheck2.default)(this, SendSlotManager);
|
19
28
|
(0, _defineProperty2.default)(this, "slots", new _map.default());
|
20
29
|
(0, _defineProperty2.default)(this, "LoggerProxy", void 0);
|
30
|
+
(0, _defineProperty2.default)(this, "sourceStateOverrides", new _map.default());
|
21
31
|
this.LoggerProxy = LoggerProxy;
|
22
32
|
}
|
23
33
|
|
@@ -87,18 +97,38 @@ var SendSlotManager = exports.default = /*#__PURE__*/function () {
|
|
87
97
|
key: "setSourceStateOverride",
|
88
98
|
value: function setSourceStateOverride(mediaType, state) {
|
89
99
|
if (mediaType !== _internalMediaCore.MediaType.VideoMain) {
|
90
|
-
throw new Error("
|
100
|
+
throw new Error("Invalid media type '".concat(mediaType, "'. Source state overrides are only applicable to ").concat(_internalMediaCore.MediaType.VideoMain, "."));
|
91
101
|
}
|
92
102
|
var slot = this.slots.get(mediaType);
|
93
103
|
if (!slot) {
|
94
104
|
throw new Error("Slot for ".concat(mediaType, " does not exist"));
|
95
105
|
}
|
106
|
+
var currentStateOverride = this.getSourceStateOverride(mediaType);
|
107
|
+
if (currentStateOverride === state) {
|
108
|
+
return;
|
109
|
+
}
|
96
110
|
if (state) {
|
97
111
|
slot.setSourceStateOverride(state);
|
112
|
+
this.sourceStateOverrides.set(mediaType, state);
|
98
113
|
} else {
|
99
114
|
slot.clearSourceStateOverride();
|
115
|
+
this.sourceStateOverrides.delete(mediaType);
|
116
|
+
}
|
117
|
+
this.LoggerProxy.logger.info("SendSlotManager->setSourceStateOverride#set source state override for ".concat(mediaType, " to ").concat(state));
|
118
|
+
}
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Gets the source state override for the given media type.
|
122
|
+
* @param {MediaType} mediaType - The type of media to get the source state override for.
|
123
|
+
* @returns {StreamState | null} - The current source state override or null if not set.
|
124
|
+
*/
|
125
|
+
}, {
|
126
|
+
key: "getSourceStateOverride",
|
127
|
+
value: function getSourceStateOverride(mediaType) {
|
128
|
+
if (mediaType !== _internalMediaCore.MediaType.VideoMain) {
|
129
|
+
throw new Error("Invalid media type '".concat(mediaType, "'. Source state overrides are only applicable to ").concat(_internalMediaCore.MediaType.VideoMain, "."));
|
100
130
|
}
|
101
|
-
this.
|
131
|
+
return this.sourceStateOverrides.get(mediaType) || null;
|
102
132
|
}
|
103
133
|
|
104
134
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_internalMediaCore","require","SendSlotManager","exports","default","LoggerProxy","_classCallCheck2","_defineProperty2","_map","_createClass2","key","value","createSlot","mediaConnection","mediaType","active","arguments","length","undefined","slots","has","Error","concat","slot","createSendSlot","set","logger","info","getSlot","get","setNamedMediaGroups","namedMediaGroups","MediaType","AudioMain","setSourceStateOverride","state","VideoMain","clearSourceStateOverride","_publishStream","_asyncToGenerator2","_regenerator","mark","_callee","stream","wrap","_callee$","_context","prev","next","publishStream","label","muted","stop","_x","_x2","apply","_unpublishStream","_callee2","_callee2$","_context2","unpublishStream","_x3","setActive","_setCodecParameters","_callee3","codecParameters","_callee3$","_context3","setCodecParameters","_x4","_x5","_deleteCodecParameters","_callee4","parameters","_callee4$","_context4","deleteCodecParameters","_x6","_x7","reset","clear"],"sources":["sendSlotManager.ts"],"sourcesContent":["import {\n SendSlot,\n MediaType,\n LocalStream,\n MultistreamRoapMediaConnection,\n NamedMediaGroup,\n StreamState,\n} from '@webex/internal-media-core';\n\nexport default class SendSlotManager {\n private readonly slots: Map<MediaType, SendSlot> = new Map();\n private readonly LoggerProxy: any;\n\n constructor(LoggerProxy: any) {\n this.LoggerProxy = LoggerProxy;\n }\n\n /**\n * This method is used to create a sendSlot for the given mediaType and returns the created sendSlot\n * @param {MultistreamRoapMediaConnection} mediaConnection MultistreamRoapMediaConnection for which a sendSlot needs to be created\n * @param {MediaType} mediaType MediaType for which a sendSlot needs to be created (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active This is optional boolean to set the active state of the sendSlot. Default is true\n * @returns {SendSlot} slot The created sendSlot\n */\n public createSlot(\n mediaConnection: MultistreamRoapMediaConnection,\n mediaType: MediaType,\n active = true\n ): SendSlot {\n if (this.slots.has(mediaType)) {\n throw new Error(`Slot for ${mediaType} already exists`);\n }\n\n const slot: SendSlot = mediaConnection.createSendSlot(mediaType, active);\n\n this.slots.set(mediaType, slot);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->createSlot#Created slot for ${mediaType} with active ${active}`\n );\n\n return slot;\n }\n\n /**\n * This method is used to retrieve the sendSlot for the given mediaType\n * @param {MediaType} mediaType of which the slot needs to be retrieved\n * @returns {SendSlot}\n */\n public getSlot(mediaType: MediaType): SendSlot {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n return slot;\n }\n\n /**\n * Allow users to specify 'namedMediaGroups' to indicate which named media group its audio should be sent to.\n * @param {MediaType} mediaType MediaType of the sendSlot to which the audio stream needs to be send to the media group\n * @param {[]}namedMediaGroups - Allow users to specify 'namedMediaGroups'.If the value of 'namedMediaGroups' is zero,\n * named media group will be canceled and the audio stream will be sent to the floor.\n * @returns {void}\n */\n public setNamedMediaGroups(mediaType: MediaType, namedMediaGroups: NamedMediaGroup[]) {\n if (mediaType !== MediaType.AudioMain) {\n throw new Error(\n `sendSlotManager cannot set named media group which media type is ${mediaType}`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.setNamedMediaGroups(namedMediaGroups);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setNamedMediaGroups#set named media group ${namedMediaGroups}`\n );\n }\n\n /**\n * Sets the source state override for the given media type.\n * @param {MediaType} mediaType - The type of media (must be MediaType.VideoMain to apply source state changes).\n * @param {StreamState | null} state - The state to set or null to clear the override value.\n * @returns {void}\n */\n public setSourceStateOverride(mediaType: MediaType, state: StreamState | null) {\n if (mediaType !== MediaType.VideoMain) {\n throw new Error(\n `sendSlotManager cannot set source state override which media type is ${mediaType}`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n if (state) {\n slot.setSourceStateOverride(state);\n } else {\n slot.clearSourceStateOverride();\n }\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setSourceStateOverride#set source state override for ${mediaType} to ${state}`\n );\n }\n\n /**\n * This method publishes the given stream to the sendSlot for the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot to which a stream needs to be published (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {LocalStream} stream LocalStream to be published\n * @returns {Promise<void>}\n */\n public async publishStream(mediaType: MediaType, stream: LocalStream): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.publishStream(stream);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->publishStream#Published stream for ${mediaType} and stream with label ${stream.label} and muted ${stream.muted}`\n );\n }\n\n /**\n * This method unpublishes the stream from the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot from which a stream needs to be unpublished (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @returns {Promise<void>}\n */\n public async unpublishStream(mediaType: MediaType): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.unpublishStream();\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->unpublishStream#Unpublished stream for ${mediaType}`\n );\n }\n\n /**\n * This method is used to set the active state of the sendSlot for the given mediaType\n * @param {MediaType} mediaType The MediaType of the sendSlot for which the active state needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active The boolean to set the active state of the sendSlot. Default is true\n * @returns {void}\n */\n public setActive(mediaType: MediaType, active = true): void {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.active = active;\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setActive#Set active for ${mediaType} to ${active}`\n );\n }\n\n /**\n * This method is used to set the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Object} codecParameters\n * @returns {Promise<void>}\n */\n public async setCodecParameters(\n mediaType: MediaType,\n codecParameters: {\n [key: string]: string | undefined; // As per ts-sdp undefined is considered as a valid value to be used for codec parameters\n }\n ): Promise<void> {\n // These codec parameter changes underneath are SDP value changes that are taken care by WCME automatically. So no need for any change in streams from the web sdk side\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.setCodecParameters(codecParameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setCodecParameters#Set codec parameters for ${mediaType} to ${codecParameters}`\n );\n }\n\n /**\n * This method is used to delete the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be deleted (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Array<String>} parameters Array of keys of the codec parameters to be deleted\n * @returns {Promise<void>}\n */\n public async deleteCodecParameters(mediaType: MediaType, parameters: string[]): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.deleteCodecParameters(parameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->deleteCodecParameters#Deleted the following codec parameters -> ${parameters} for ${mediaType}`\n );\n }\n\n /**\n * This method is used to reset the SendSlotsManager by deleting all the sendSlots\n * @returns {undefined}\n */\n public reset(): void {\n this.slots.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAOoC,IAEfC,eAAe,GAAAC,OAAA,CAAAC,OAAA;EAIlC,SAAAF,gBAAYG,WAAgB,EAAE;IAAA,IAAAC,gBAAA,CAAAF,OAAA,QAAAF,eAAA;IAAA,IAAAK,gBAAA,CAAAH,OAAA,iBAHqB,IAAAI,IAAA,CAAAJ,OAAA,CAAQ,CAAC;IAAA,IAAAG,gBAAA,CAAAH,OAAA;IAI1D,IAAI,CAACC,WAAW,GAAGA,WAAW;EAChC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE,IAAAI,aAAA,CAAAL,OAAA,EAAAF,eAAA;IAAAQ,GAAA;IAAAC,KAAA,EAOA,SAAAC,WACEC,eAA+C,EAC/CC,SAAoB,EAEV;MAAA,IADVC,MAAM,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;MAEb,IAAI,IAAI,CAACG,KAAK,CAACC,GAAG,CAACN,SAAS,CAAC,EAAE;QAC7B,MAAM,IAAIO,KAAK,aAAAC,MAAA,CAAaR,SAAS,oBAAiB,CAAC;MACzD;MAEA,IAAMS,IAAc,GAAGV,eAAe,CAACW,cAAc,CAACV,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AAA;QAAA,OAAAP,sBAAA,CAAAhB,KAAA,OAAAvC,SAAA;MAAA;MAAA,OAAA4D,qBAAA;IAAA;IAED;AACF;AACA;AACA;IAHE;EAAA;IAAAlE,GAAA;IAAAC,KAAA,EAIA,SAAAoE,MAAA,EAAqB;MACnB,IAAI,CAAC5D,KAAK,CAAC6D,KAAK,CAAC,CAAC;IACpB;EAAC;EAAA,OAAA9E,eAAA;AAAA"}
|
1
|
+
{"version":3,"names":["_internalMediaCore","require","SendSlotManager","exports","default","LoggerProxy","_classCallCheck2","_defineProperty2","_map","_createClass2","key","value","createSlot","mediaConnection","mediaType","active","arguments","length","undefined","slots","has","Error","concat","slot","createSendSlot","set","logger","info","getSlot","get","setNamedMediaGroups","namedMediaGroups","MediaType","AudioMain","setSourceStateOverride","state","VideoMain","currentStateOverride","getSourceStateOverride","sourceStateOverrides","clearSourceStateOverride","delete","_publishStream","_asyncToGenerator2","_regenerator","mark","_callee","stream","wrap","_callee$","_context","prev","next","publishStream","label","muted","stop","_x","_x2","apply","_unpublishStream","_callee2","_callee2$","_context2","unpublishStream","_x3","setActive","_setCodecParameters","_callee3","codecParameters","_callee3$","_context3","setCodecParameters","_x4","_x5","_deleteCodecParameters","_callee4","parameters","_callee4$","_context4","deleteCodecParameters","_x6","_x7","reset","clear"],"sources":["sendSlotManager.ts"],"sourcesContent":["import {\n SendSlot,\n MediaType,\n LocalStream,\n MultistreamRoapMediaConnection,\n NamedMediaGroup,\n StreamState,\n} from '@webex/internal-media-core';\n\n/**\n * This class is used to manage the sendSlots for the given media types.\n */\nexport default class SendSlotManager {\n private readonly slots: Map<MediaType, SendSlot> = new Map();\n private readonly LoggerProxy: any;\n private readonly sourceStateOverrides: Map<MediaType, StreamState> = new Map();\n\n /**\n * Constructor for SendSlotManager\n *\n * @param {any} LoggerProxy is used to log the messages\n * @constructor\n */\n constructor(LoggerProxy: any) {\n this.LoggerProxy = LoggerProxy;\n }\n\n /**\n * This method is used to create a sendSlot for the given mediaType and returns the created sendSlot\n * @param {MultistreamRoapMediaConnection} mediaConnection MultistreamRoapMediaConnection for which a sendSlot needs to be created\n * @param {MediaType} mediaType MediaType for which a sendSlot needs to be created (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active This is optional boolean to set the active state of the sendSlot. Default is true\n * @returns {SendSlot} slot The created sendSlot\n */\n public createSlot(\n mediaConnection: MultistreamRoapMediaConnection,\n mediaType: MediaType,\n active = true\n ): SendSlot {\n if (this.slots.has(mediaType)) {\n throw new Error(`Slot for ${mediaType} already exists`);\n }\n\n const slot: SendSlot = mediaConnection.createSendSlot(mediaType, active);\n\n this.slots.set(mediaType, slot);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->createSlot#Created slot for ${mediaType} with active ${active}`\n );\n\n return slot;\n }\n\n /**\n * This method is used to retrieve the sendSlot for the given mediaType\n * @param {MediaType} mediaType of which the slot needs to be retrieved\n * @returns {SendSlot}\n */\n public getSlot(mediaType: MediaType): SendSlot {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n return slot;\n }\n\n /**\n * Allow users to specify 'namedMediaGroups' to indicate which named media group its audio should be sent to.\n * @param {MediaType} mediaType MediaType of the sendSlot to which the audio stream needs to be send to the media group\n * @param {[]}namedMediaGroups - Allow users to specify 'namedMediaGroups'.If the value of 'namedMediaGroups' is zero,\n * named media group will be canceled and the audio stream will be sent to the floor.\n * @returns {void}\n */\n public setNamedMediaGroups(mediaType: MediaType, namedMediaGroups: NamedMediaGroup[]) {\n if (mediaType !== MediaType.AudioMain) {\n throw new Error(\n `sendSlotManager cannot set named media group which media type is ${mediaType}`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.setNamedMediaGroups(namedMediaGroups);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setNamedMediaGroups#set named media group ${namedMediaGroups}`\n );\n }\n\n /**\n * Sets the source state override for the given media type.\n * @param {MediaType} mediaType - The type of media (must be MediaType.VideoMain to apply source state changes).\n * @param {StreamState | null} state - The state to set or null to clear the override value.\n * @returns {void}\n */\n public setSourceStateOverride(mediaType: MediaType, state: StreamState | null) {\n if (mediaType !== MediaType.VideoMain) {\n throw new Error(\n `Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n const currentStateOverride = this.getSourceStateOverride(mediaType);\n if (currentStateOverride === state) {\n return;\n }\n\n if (state) {\n slot.setSourceStateOverride(state);\n this.sourceStateOverrides.set(mediaType, state);\n } else {\n slot.clearSourceStateOverride();\n this.sourceStateOverrides.delete(mediaType);\n }\n\n this.LoggerProxy.logger.info(\n `SendSlotManager->setSourceStateOverride#set source state override for ${mediaType} to ${state}`\n );\n }\n\n /**\n * Gets the source state override for the given media type.\n * @param {MediaType} mediaType - The type of media to get the source state override for.\n * @returns {StreamState | null} - The current source state override or null if not set.\n */\n private getSourceStateOverride(mediaType: MediaType): StreamState | null {\n if (mediaType !== MediaType.VideoMain) {\n throw new Error(\n `Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`\n );\n }\n\n return this.sourceStateOverrides.get(mediaType) || null;\n }\n\n /**\n * This method publishes the given stream to the sendSlot for the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot to which a stream needs to be published (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {LocalStream} stream LocalStream to be published\n * @returns {Promise<void>}\n */\n public async publishStream(mediaType: MediaType, stream: LocalStream): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.publishStream(stream);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->publishStream#Published stream for ${mediaType} and stream with label ${stream.label} and muted ${stream.muted}`\n );\n }\n\n /**\n * This method unpublishes the stream from the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot from which a stream needs to be unpublished (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @returns {Promise<void>}\n */\n public async unpublishStream(mediaType: MediaType): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.unpublishStream();\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->unpublishStream#Unpublished stream for ${mediaType}`\n );\n }\n\n /**\n * This method is used to set the active state of the sendSlot for the given mediaType\n * @param {MediaType} mediaType The MediaType of the sendSlot for which the active state needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active The boolean to set the active state of the sendSlot. Default is true\n * @returns {void}\n */\n public setActive(mediaType: MediaType, active = true): void {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.active = active;\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setActive#Set active for ${mediaType} to ${active}`\n );\n }\n\n /**\n * This method is used to set the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Object} codecParameters\n * @returns {Promise<void>}\n */\n public async setCodecParameters(\n mediaType: MediaType,\n codecParameters: {\n [key: string]: string | undefined; // As per ts-sdp undefined is considered as a valid value to be used for codec parameters\n }\n ): Promise<void> {\n // These codec parameter changes underneath are SDP value changes that are taken care by WCME automatically. So no need for any change in streams from the web sdk side\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.setCodecParameters(codecParameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setCodecParameters#Set codec parameters for ${mediaType} to ${codecParameters}`\n );\n }\n\n /**\n * This method is used to delete the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be deleted (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Array<String>} parameters Array of keys of the codec parameters to be deleted\n * @returns {Promise<void>}\n */\n public async deleteCodecParameters(mediaType: MediaType, parameters: string[]): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.deleteCodecParameters(parameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->deleteCodecParameters#Deleted the following codec parameters -> ${parameters} for ${mediaType}`\n );\n }\n\n /**\n * This method is used to reset the SendSlotsManager by deleting all the sendSlots\n * @returns {undefined}\n */\n public reset(): void {\n this.slots.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AASA;AACA;AACA;AAFA,IAGqBC,eAAe,GAAAC,OAAA,CAAAC,OAAA;EAKlC;AACF;AACA;AACA;AACA;AACA;EACE,SAAAF,gBAAYG,WAAgB,EAAE;IAAA,IAAAC,gBAAA,CAAAF,OAAA,QAAAF,eAAA;IAAA,IAAAK,gBAAA,CAAAH,OAAA,iBAVqB,IAAAI,IAAA,CAAAJ,OAAA,CAAQ,CAAC;IAAA,IAAAG,gBAAA,CAAAH,OAAA;IAAA,IAAAG,gBAAA,CAAAH,OAAA,gCAES,IAAAI,IAAA,CAAAJ,OAAA,CAAQ,CAAC;IAS5E,IAAI,CAACC,WAAW,GAAGA,WAAW;EAChC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE,IAAAI,aAAA,CAAAL,OAAA,EAAAF,eAAA;IAAAQ,GAAA;IAAAC,KAAA,EAOA,SAAAC,WACEC,eAA+C,EAC/CC,SAAo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@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
180
180
|
}()
|
181
181
|
/**
|
182
182
|
* Checks if the given subnet is reachable
|
183
|
-
* @param {string}
|
183
|
+
* @param {string} selectedSubnetFirstOctet - selected subnet first octet, e.g. "10" for "10.X.X.X"
|
184
184
|
* @returns {boolean | null} true if reachable, false if not reachable, null if mediaServerIp is not provided
|
185
185
|
* @public
|
186
186
|
* @memberof Reachability
|
@@ -188,20 +188,15 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
188
188
|
)
|
189
189
|
}, {
|
190
190
|
key: "isSubnetReachable",
|
191
|
-
value: function isSubnetReachable(
|
192
|
-
|
193
|
-
_loggerProxy.default.logger.error("Reachability:index#isSubnetReachable --> mediaServerIp is null");
|
194
|
-
return null;
|
195
|
-
}
|
196
|
-
var subnetFirstOctet = mediaServerIp.split('.')[0];
|
197
|
-
_loggerProxy.default.logger.info("Reachability:index#isSubnetReachable --> Looking for subnet: ".concat(subnetFirstOctet, ".X.X.X"));
|
191
|
+
value: function isSubnetReachable(selectedSubnetFirstOctet) {
|
192
|
+
_loggerProxy.default.logger.info("Reachability:index#isSubnetReachable --> Looking for subnet: ".concat(selectedSubnetFirstOctet, ".X.X.X"));
|
198
193
|
var matchingReachedClusters = (0, _values.default)(this.clusterReachability).reduce(function (acc, cluster) {
|
199
194
|
var reachedSubnetsArray = (0, _from.default)(cluster.reachedSubnets);
|
200
195
|
var logMessage = "Reachability:index#isSubnetReachable --> Cluster ".concat(cluster.name, " reached [");
|
201
196
|
for (var i = 0; i < reachedSubnetsArray.length; i += 1) {
|
202
197
|
var subnet = reachedSubnetsArray[i];
|
203
198
|
var reachedSubnetFirstOctet = subnet.split('.')[0];
|
204
|
-
if (
|
199
|
+
if (selectedSubnetFirstOctet === reachedSubnetFirstOctet) {
|
205
200
|
acc.add(cluster.name);
|
206
201
|
}
|
207
202
|
logMessage += "".concat(subnet);
|
@@ -213,7 +208,7 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
|
|
213
208
|
_loggerProxy.default.logger.info(logMessage);
|
214
209
|
return acc;
|
215
210
|
}, new _set.default());
|
216
|
-
_loggerProxy.default.logger.info("Reachability:index#isSubnetReachable --> Found ".concat(matchingReachedClusters.size, " clusters that use the subnet ").concat(
|
211
|
+
_loggerProxy.default.logger.info("Reachability:index#isSubnetReachable --> Found ".concat(matchingReachedClusters.size, " clusters that use the subnet ").concat(selectedSubnetFirstOctet, ".X.X.X"));
|
217
212
|
return matchingReachedClusters.size > 0;
|
218
213
|
}
|
219
214
|
|