@webex/plugin-meetings 3.0.0-stream-classes.4 → 3.0.0-stream-classes.5

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.
Files changed (44) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/constants.js +3 -1
  4. package/dist/constants.js.map +1 -1
  5. package/dist/interpretation/index.js +1 -1
  6. package/dist/interpretation/siLanguage.js +1 -1
  7. package/dist/locus-info/index.js +25 -1
  8. package/dist/locus-info/index.js.map +1 -1
  9. package/dist/locus-info/parser.js +5 -0
  10. package/dist/locus-info/parser.js.map +1 -1
  11. package/dist/meeting/index.js +72 -15
  12. package/dist/meeting/index.js.map +1 -1
  13. package/dist/meeting/request.js +1 -1
  14. package/dist/meeting/request.js.map +1 -1
  15. package/dist/metrics/constants.js +3 -1
  16. package/dist/metrics/constants.js.map +1 -1
  17. package/dist/multistream/remoteMediaManager.js +46 -9
  18. package/dist/multistream/remoteMediaManager.js.map +1 -1
  19. package/dist/types/constants.d.ts +1 -0
  20. package/dist/types/meeting/index.d.ts +16 -2
  21. package/dist/types/meeting/locusMediaRequest.d.ts +1 -2
  22. package/dist/types/meeting/request.d.ts +2 -1
  23. package/dist/types/meeting/util.d.ts +9 -1
  24. package/dist/types/metrics/constants.d.ts +3 -0
  25. package/dist/types/multistream/remoteMediaManager.d.ts +9 -1
  26. package/dist/types/reachability/index.d.ts +0 -6
  27. package/dist/types/reachability/request.d.ts +1 -1
  28. package/dist/types/roap/request.d.ts +2 -1
  29. package/package.json +1 -1
  30. package/src/constants.ts +1 -0
  31. package/src/locus-info/index.ts +33 -2
  32. package/src/locus-info/parser.ts +7 -0
  33. package/src/meeting/index.ts +59 -16
  34. package/src/meeting/request.ts +1 -1
  35. package/src/metrics/constants.ts +2 -0
  36. package/src/multistream/remoteMediaManager.ts +41 -4
  37. package/test/integration/spec/converged-space-meetings.js +7 -7
  38. package/test/integration/spec/journey.js +85 -103
  39. package/test/integration/spec/space-meeting.js +9 -9
  40. package/test/unit/spec/locus-info/index.js +118 -1
  41. package/test/unit/spec/meeting/index.js +88 -25
  42. package/test/unit/spec/meetings/index.js +2 -2
  43. package/test/unit/spec/multistream/remoteMediaManager.ts +10 -2
  44. package/test/utils/integrationTestUtils.js +4 -4
@@ -1 +1 @@
1
- {"version":3,"names":["AllEqualLayout","activeSpeakerVideoPaneGroups","id","numPanes","size","priority","SingleLayout","OnePlusFiveLayout","TwoMainPlusSixSmallLayout","RemoteScreenShareWithSmallThumbnailsLayout","screenShareVideo","Stage2x2With6ThumbnailsLayout","memberVideoPanes","csi","undefined","DefaultConfiguration","audio","numOfActiveSpeakerStreams","numOfScreenShareStreams","video","preferLiveVideo","initialLayoutId","layouts","AllEqual","OnePlusFive","Single","Stage","ScreenShareView","Event","RemoteMediaManager","receiveSlotManager","mediaRequestManagers","config","started","media","activeSpeakerGroups","memberPanes","screenShare","checkConfigValidity","slots","unused","activeSpeaker","receiverSelected","receiveSlotAllocations","LoggerProxy","logger","log","Error","forEach","layout","groupIds","paneIds","groupPriorites","group","pane","createAudioMedia","createScreenShareReceiveSlots","createScreenShareAudioMedia","preallocateVideoReceiveSlots","setLayout","invalidateCurrentRemoteMedia","screenShareAudio","commit","slot","releaseSlot","length","push","releaseUnusedVideoSlots","currentLayout","currentLayoutId","activeSpeakerCount","reduce","sum","paneGroup","receiverSelectedCount","maxNumVideoPanesRequired","maxValue","Math","max","getRequiredNumVideoSlotsForLayout","allocateSlot","MediaType","VideoMain","layoutId","updateVideoReceiveSlots","updateVideoRemoteMediaObjects","updateScreenShareVideoRemoteMediaObject","emitVideoLayoutChangedEvent","activeSpeakerGroup","setPreferLiveVideo","remoteMediaCsis","remoteMediaGroup","groupRemoteMediaCsis","filter","remoteMedia","includes","setActiveSpeakerCsis","i","AudioMain","RemoteMediaGroup","emit","file","function","AudioCreated","AudioSlides","isAnyLayoutContainingScreenShareVideo","some","VideoSlides","ScreenShareAudioCreated","requiredCsis","memberVideoPane","isCsiNeededByCurrentLayout","notNeededReceiverSelectedSlots","sort","a","b","paneIndex","freeSlot","shift","memberPane","existingSlot","find","isExistingSlotAlreadyAllocated","pop","requiredNumSlots","totalNumSlots","numSlotsToCreate","logMessage","groupName","map","logString","join","key","trimActiveSpeakerSlots","trimReceiverSelectedSlots","refillRequiredSlotsIfNeeded","allocateSlotsToActiveSpeakerPaneGroups","allocateSlotsToReceiverSelectedVideoPaneGroups","logReceieveSlots","groupId","paneGroupInCurrentLayout","groupInLayout","mediaGroup","resolution","warn","paneId","paneInCurrentLayout","paneInLayout","RemoteMedia","sendMediaRequest","options","stop","VideoLayoutChanged","activeSpeakerVideoPanes","getRemoteMedia","cancelMediaRequest","newPane","receiveSlot","reject","resolve","getUnderlyingReceiveSlot","index","indexOf","splice","pin","unpin","isPinned","EventsScope"],"sources":["remoteMediaManager.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {cloneDeep, forEach, remove} from 'lodash';\nimport {EventMap} from 'typed-emitter';\nimport {MediaType} from '@webex/internal-media-core';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport EventsScope from '../common/events/events-scope';\n\nimport {RemoteMedia, RemoteVideoResolution} from './remoteMedia';\nimport {ReceiveSlot, CSI} from './receiveSlot';\nimport {ReceiveSlotManager} from './receiveSlotManager';\nimport {RemoteMediaGroup} from './remoteMediaGroup';\nimport {MediaRequestManager} from './mediaRequestManager';\n\nexport type PaneSize = RemoteVideoResolution;\nexport type LayoutId = string;\nexport type PaneId = string;\nexport type PaneGroupId = string;\n\nexport interface ActiveSpeakerVideoPaneGroup {\n id: PaneGroupId;\n numPanes: number; // maximum number of panes in the group (actual number may be lower, if there are not enough participants in the meeting)\n size: PaneSize; // preferred size for all panes in the group\n priority: number; // 0-255 (255 = highest priority), each group must have a different priority from all other groups\n}\n\nexport interface MemberVideoPane {\n id: PaneId;\n size: PaneSize;\n csi?: CSI;\n}\n\nexport interface VideoLayout {\n screenShareVideo?: {\n size: PaneSize;\n };\n activeSpeakerVideoPaneGroups?: ActiveSpeakerVideoPaneGroup[]; // list of active speaker video pane groups\n memberVideoPanes?: MemberVideoPane[]; // list of video panes for specific members, CSI values can be changed later via setVideoPaneCsi()\n}\n\nexport interface Configuration {\n audio: {\n numOfActiveSpeakerStreams: number; // number of audio streams we want to receive\n numOfScreenShareStreams: number; // 1 should be enough, because in webex only 1 person at a time can be presenting screen share\n };\n video: {\n preferLiveVideo: boolean; // applies to all pane groups with active speaker policy\n initialLayoutId: LayoutId;\n\n layouts: {[key: LayoutId]: VideoLayout}; // a map of all available layouts, a layout can be set via setLayout() method\n };\n}\n\n/* Predefined layouts: */\n\n// An \"all equal\" grid, with size up to 3 x 3 = 9:\nconst AllEqualLayout: VideoLayout = {\n activeSpeakerVideoPaneGroups: [\n {\n id: 'main',\n numPanes: 9,\n size: 'best',\n priority: 255,\n },\n ],\n};\n\n// A layout with just a single remote active speaker video pane:\nconst SingleLayout: VideoLayout = {\n activeSpeakerVideoPaneGroups: [\n {\n id: 'main',\n numPanes: 1,\n size: 'best',\n priority: 255,\n },\n ],\n};\n\n// A layout with 1 big pane for the highest priority active speaker and 5 small panes for other active speakers:\nconst OnePlusFiveLayout: VideoLayout = {\n activeSpeakerVideoPaneGroups: [\n {\n id: 'mainBigOne',\n numPanes: 1,\n size: 'large',\n priority: 255,\n },\n {\n id: 'secondarySetOfSmallPanes',\n numPanes: 5,\n size: 'very small',\n priority: 254,\n },\n ],\n};\n\n// A layout with 2 big panes for 2 main active speakers and a strip of 6 small panes for other active speakers:\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst TwoMainPlusSixSmallLayout: VideoLayout = {\n activeSpeakerVideoPaneGroups: [\n {\n id: 'mainGroupWith2BigPanes',\n numPanes: 2,\n size: 'large',\n priority: 255,\n },\n {\n id: 'secondaryGroupOfSmallPanes',\n numPanes: 6,\n size: 'small',\n priority: 254,\n },\n ],\n};\n\n// A strip of 8 small video panes (thumbnails) displayed at the top of a remote screenshare:\nconst RemoteScreenShareWithSmallThumbnailsLayout: VideoLayout = {\n screenShareVideo: {size: 'best'},\n activeSpeakerVideoPaneGroups: [\n {\n id: 'thumbnails',\n numPanes: 8,\n size: 'thumbnail',\n priority: 255,\n },\n ],\n};\n\n// A staged layout with 4 pre-selected meeting participants in the main 2x2 grid and 6 small panes for other active speakers at the top:\nconst Stage2x2With6ThumbnailsLayout: VideoLayout = {\n activeSpeakerVideoPaneGroups: [\n {\n id: 'thumbnails',\n numPanes: 6,\n size: 'thumbnail',\n priority: 255,\n },\n ],\n memberVideoPanes: [\n {id: 'stage-1', size: 'medium', csi: undefined},\n {id: 'stage-2', size: 'medium', csi: undefined},\n {id: 'stage-3', size: 'medium', csi: undefined},\n {id: 'stage-4', size: 'medium', csi: undefined},\n ],\n};\n\n/**\n * Default configuration:\n * - uses 3 audio streams\n * - prefers active speakers with live video (e.g. are not audio only or video muted) over active speakers without live video\n * - has a few layouts defined, including 1 that contains remote screen share (ScreenShareView)\n */\nexport const DefaultConfiguration: Configuration = {\n audio: {\n numOfActiveSpeakerStreams: 3,\n numOfScreenShareStreams: 1,\n },\n video: {\n preferLiveVideo: true,\n initialLayoutId: 'AllEqual',\n\n layouts: {\n AllEqual: AllEqualLayout,\n OnePlusFive: OnePlusFiveLayout,\n Single: SingleLayout,\n Stage: Stage2x2With6ThumbnailsLayout,\n ScreenShareView: RemoteScreenShareWithSmallThumbnailsLayout,\n },\n },\n};\n\nexport enum Event {\n // events for audio streams\n AudioCreated = 'AudioCreated',\n ScreenShareAudioCreated = 'ScreenShareAudioCreated',\n\n // events for video streams\n VideoLayoutChanged = 'VideoLayoutChanged',\n}\n\nexport interface VideoLayoutChangedEventData {\n layoutId: LayoutId;\n activeSpeakerVideoPanes: {\n [key: PaneGroupId]: RemoteMediaGroup;\n };\n memberVideoPanes: {[key: PaneId]: RemoteMedia};\n screenShareVideo?: RemoteMedia;\n}\nexport interface Events extends EventMap {\n // audio\n [Event.AudioCreated]: (audio: RemoteMediaGroup) => void;\n [Event.ScreenShareAudioCreated]: (screenShareAudio: RemoteMediaGroup) => void;\n\n // video\n [Event.VideoLayoutChanged]: (data: VideoLayoutChangedEventData) => void;\n}\n\n/**\n * A helper class that manages all remote audio/video streams in order to achieve a predefined set of layouts.\n * It also creates a fixed number of audio streams and these don't change during the meeting.\n *\n * Things that RemoteMediaManager does:\n * - owns the receive slots (creates them when needed, and re-uses them when switching layouts)\n * - constructs appropriate RemoteMedia and RemoteMediaGroup objects and sends appropriate mediaRequests\n */\nexport class RemoteMediaManager extends EventsScope {\n private config: Configuration;\n\n private started: boolean;\n\n private receiveSlotManager: ReceiveSlotManager;\n\n private mediaRequestManagers: {\n audio: MediaRequestManager;\n video: MediaRequestManager;\n screenShareAudio: MediaRequestManager;\n screenShareVideo: MediaRequestManager;\n };\n\n private currentLayout?: VideoLayout;\n\n private slots: {\n audio: ReceiveSlot[];\n screenShare: {\n audio: ReceiveSlot[];\n video?: ReceiveSlot;\n };\n video: {\n unused: ReceiveSlot[];\n activeSpeaker: ReceiveSlot[];\n receiverSelected: ReceiveSlot[];\n };\n };\n\n private media: {\n audio?: RemoteMediaGroup;\n video: {\n activeSpeakerGroups: {\n [key: PaneGroupId]: RemoteMediaGroup;\n };\n memberPanes: {[key: PaneId]: RemoteMedia};\n };\n screenShare: {\n audio?: RemoteMediaGroup;\n video?: RemoteMediaGroup;\n };\n };\n\n private receiveSlotAllocations: {\n activeSpeaker: {[key: PaneGroupId]: {slots: ReceiveSlot[]}};\n receiverSelected: {[key: PaneId]: ReceiveSlot};\n };\n\n private currentLayoutId?: LayoutId;\n\n /**\n * Constructor\n *\n * @param {ReceiveSlotManager} receiveSlotManager\n * @param {{audio: MediaRequestManager, video: mediaRequestManagers}} mediaRequestManagers\n * @param {Configuration} config Configuration describing what video layouts to use during the meeting\n */\n constructor(\n receiveSlotManager: ReceiveSlotManager,\n mediaRequestManagers: {\n audio: MediaRequestManager;\n video: MediaRequestManager;\n screenShareAudio: MediaRequestManager;\n screenShareVideo: MediaRequestManager;\n },\n config: Configuration = DefaultConfiguration\n ) {\n super();\n this.started = false;\n this.config = config;\n this.receiveSlotManager = receiveSlotManager;\n this.mediaRequestManagers = mediaRequestManagers;\n this.media = {\n audio: undefined,\n video: {\n activeSpeakerGroups: {},\n memberPanes: {},\n },\n screenShare: {\n audio: undefined,\n video: undefined,\n },\n };\n\n this.checkConfigValidity();\n\n this.slots = {\n audio: [],\n screenShare: {\n audio: [],\n video: undefined,\n },\n video: {\n unused: [],\n activeSpeaker: [],\n receiverSelected: [],\n },\n };\n\n this.receiveSlotAllocations = {activeSpeaker: {}, receiverSelected: {}};\n\n LoggerProxy.logger.log(\n `RemoteMediaManager#constructor --> RemoteMediaManager created with config: ${JSON.stringify(\n this.config\n )}`\n );\n }\n\n /**\n * Checks if configuration is valid, throws an error if it's not\n */\n private checkConfigValidity() {\n if (!(this.config.video.initialLayoutId in this.config.video.layouts)) {\n throw new Error(\n `invalid config: initialLayoutId \"${this.config.video.initialLayoutId}\" doesn't match any of the layouts`\n );\n }\n\n // check if each layout is valid\n Object.values(this.config.video.layouts).forEach((layout) => {\n const groupIds = {};\n const paneIds = {};\n const groupPriorites = {};\n\n layout.activeSpeakerVideoPaneGroups?.forEach((group) => {\n if (groupIds[group.id]) {\n throw new Error(\n `invalid config: duplicate active speaker video pane group id: ${group.id}`\n );\n }\n groupIds[group.id] = true;\n\n if (groupPriorites[group.priority]) {\n throw new Error(\n `invalid config: multiple active speaker video pane groups have same priority: ${group.priority}`\n );\n }\n groupPriorites[group.priority] = true;\n });\n\n layout.memberVideoPanes?.forEach((pane) => {\n if (paneIds[pane.id]) {\n throw new Error(`invalid config: duplicate member video pane id: ${pane.id}`);\n }\n paneIds[pane.id] = true;\n });\n });\n }\n\n /**\n * Starts the RemoteMediaManager.\n *\n * @returns {Promise}\n */\n public async start() {\n if (this.started) {\n throw new Error('start() failure: already started');\n }\n this.started = true;\n\n await this.createAudioMedia();\n\n await this.createScreenShareReceiveSlots();\n this.createScreenShareAudioMedia();\n\n await this.preallocateVideoReceiveSlots();\n\n await this.setLayout(this.config.video.initialLayoutId);\n }\n\n /**\n * Releases all the used resources (like allocated receive slots). This function needs\n * to be called when we leave the meeting, etc.\n */\n public stop() {\n // invalidate all remoteMedia objects\n this.invalidateCurrentRemoteMedia({\n audio: true,\n video: true,\n screenShareAudio: true,\n screenShareVideo: true,\n commit: true,\n });\n\n // release all audio receive slots\n this.slots.audio.forEach((slot) => this.receiveSlotManager.releaseSlot(slot));\n this.slots.audio.length = 0;\n\n // release screen share slots\n this.slots.screenShare.audio.forEach((slot) => this.receiveSlotManager.releaseSlot(slot));\n this.slots.screenShare.audio.length = 0;\n if (this.slots.screenShare.video) {\n this.receiveSlotManager.releaseSlot(this.slots.screenShare.video);\n this.slots.screenShare.video = undefined;\n }\n\n // release video slots\n this.receiveSlotAllocations = {activeSpeaker: {}, receiverSelected: {}};\n\n this.slots.video.unused.push(...this.slots.video.activeSpeaker);\n this.slots.video.activeSpeaker.length = 0;\n\n this.slots.video.unused.push(...this.slots.video.receiverSelected);\n this.slots.video.receiverSelected.length = 0;\n\n this.releaseUnusedVideoSlots();\n\n this.currentLayout = undefined;\n this.currentLayoutId = undefined;\n this.started = false;\n }\n\n /**\n * Returns the total number of main video panes required for a given layout\n *\n * @param {VideoLayout} layout\n * @returns {number}\n */\n private getRequiredNumVideoSlotsForLayout(layout?: VideoLayout) {\n if (!layout) {\n return 0;\n }\n\n const activeSpeakerCount =\n layout.activeSpeakerVideoPaneGroups?.reduce(\n (sum, paneGroup) => sum + paneGroup.numPanes,\n 0\n ) || 0;\n\n const receiverSelectedCount = layout.memberVideoPanes?.length || 0;\n\n return activeSpeakerCount + receiverSelectedCount;\n }\n\n /**\n * Allocates the maximum number of panes that any of the configured layouts will require.\n * We do this at the beginning, because it's more efficient (much faster) then allocating receive slots\n * later, after the SDP exchange was done.\n */\n private async preallocateVideoReceiveSlots() {\n const maxNumVideoPanesRequired = Object.values(this.config.video.layouts).reduce(\n (maxValue, layout) => Math.max(maxValue, this.getRequiredNumVideoSlotsForLayout(layout)),\n 0\n );\n\n while (this.slots.video.unused.length < maxNumVideoPanesRequired) {\n // eslint-disable-next-line no-await-in-loop\n this.slots.video.unused.push(\n // eslint-disable-next-line no-await-in-loop\n await this.receiveSlotManager.allocateSlot(MediaType.VideoMain)\n );\n }\n }\n\n /**\n * Changes the layout (triggers Event.VideoLayoutChanged)\n *\n * @param {LayoutId} layoutId new layout id\n * @returns {Promise}\n */\n public async setLayout(layoutId: LayoutId) {\n if (!(layoutId in this.config.video.layouts)) {\n throw new Error(\n `invalid layoutId: \"${layoutId}\" doesn't match any of the configured layouts`\n );\n }\n if (!this.started) {\n throw new Error('setLayout() called before start()');\n }\n this.currentLayoutId = layoutId;\n this.currentLayout = cloneDeep(this.config.video.layouts[this.currentLayoutId]);\n\n await this.updateVideoReceiveSlots();\n this.updateVideoRemoteMediaObjects();\n this.updateScreenShareVideoRemoteMediaObject();\n this.emitVideoLayoutChangedEvent();\n }\n\n /**\n * Returns the currently selected layout id\n *\n * @returns {LayoutId}\n */\n public getLayoutId(): LayoutId | undefined {\n return this.currentLayoutId;\n }\n\n /**\n * sets the preferLiveVideo\n */\n public setPreferLiveVideo(preferLiveVideo: boolean) {\n LoggerProxy.logger.log(\n `RemoteMediaManager#setPreferLiveVideo --> setPreferLiveVideo is called to set preferLiveVideo to ${preferLiveVideo}`\n );\n this.config.video.preferLiveVideo = preferLiveVideo;\n Object.values(this.media.video.activeSpeakerGroups).forEach((activeSpeakerGroup) => {\n activeSpeakerGroup.setPreferLiveVideo(preferLiveVideo, false);\n });\n this.mediaRequestManagers.video.commit();\n }\n\n /**\n * Sets CSIs for multiple RemoteMedia instances belonging to 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 */\n public setActiveSpeakerCsis(remoteMediaCsis: {remoteMedia: RemoteMedia; csi?: number}[]) {\n Object.values(this.media.video.activeSpeakerGroups).forEach((remoteMediaGroup) => {\n const groupRemoteMediaCsis = remoteMediaCsis.filter(({remoteMedia}) =>\n remoteMediaGroup.includes(remoteMedia)\n );\n if (groupRemoteMediaCsis.length > 0) {\n remoteMediaGroup.setActiveSpeakerCsis(groupRemoteMediaCsis, false);\n }\n });\n this.mediaRequestManagers.video.commit();\n }\n\n /**\n * Creates the audio slots\n */\n private async createAudioMedia() {\n // create the audio receive slots\n for (let i = 0; i < this.config.audio.numOfActiveSpeakerStreams; i += 1) {\n // eslint-disable-next-line no-await-in-loop\n const slot = await this.receiveSlotManager.allocateSlot(MediaType.AudioMain);\n\n this.slots.audio.push(slot);\n }\n\n // create a remote media group\n this.media.audio = new RemoteMediaGroup(\n this.mediaRequestManagers.audio,\n this.slots.audio,\n 255,\n true\n );\n\n this.emit(\n {file: 'multistream/remoteMediaManager', function: 'createAudioMedia'},\n Event.AudioCreated,\n this.media.audio\n );\n }\n\n /**\n * Creates receive slots required for receiving screen share audio and video\n */\n private async createScreenShareReceiveSlots() {\n // audio\n for (let i = 0; i < this.config.audio.numOfScreenShareStreams; i += 1) {\n // eslint-disable-next-line no-await-in-loop\n const slot = await this.receiveSlotManager.allocateSlot(MediaType.AudioSlides);\n\n this.slots.screenShare.audio.push(slot);\n }\n\n // video\n const isAnyLayoutContainingScreenShareVideo = Object.values(this.config.video.layouts).some(\n (layout) => !!layout.screenShareVideo\n );\n\n if (isAnyLayoutContainingScreenShareVideo) {\n this.slots.screenShare.video = await this.receiveSlotManager.allocateSlot(\n MediaType.VideoSlides\n );\n }\n }\n\n /**\n * Creates RemoteMedia objects for screen share\n */\n private createScreenShareAudioMedia() {\n if (this.slots.screenShare.audio.length > 0) {\n this.media.screenShare.audio = new RemoteMediaGroup(\n this.mediaRequestManagers.screenShareAudio,\n this.slots.screenShare.audio,\n 255,\n true\n );\n\n this.emit(\n {file: 'multistream/remoteMediaManager', function: 'createScreenShareAudioMedia'},\n Event.ScreenShareAudioCreated,\n this.media.screenShare.audio\n );\n }\n }\n\n /**\n * Goes over all receiver-selected slots and keeps only the ones that are required by a given layout,\n * the rest are all moved to the \"unused\" list\n */\n private trimReceiverSelectedSlots() {\n const requiredCsis = {};\n\n // fill requiredCsis with all the CSIs that the given layout requires\n this.currentLayout?.memberVideoPanes?.forEach((memberVideoPane) => {\n if (memberVideoPane.csi !== undefined) {\n requiredCsis[memberVideoPane.csi] = true;\n }\n });\n\n const isCsiNeededByCurrentLayout = (csi?: CSI): boolean => {\n if (csi === undefined) {\n return false;\n }\n\n return !!requiredCsis[csi];\n };\n\n // keep receiverSelected slots that match our new requiredCsis, move the rest of receiverSelected slots to unused\n const notNeededReceiverSelectedSlots = remove(\n this.slots.video.receiverSelected,\n (slot) => isCsiNeededByCurrentLayout(slot.csi) === false\n );\n\n this.slots.video.unused.push(...notNeededReceiverSelectedSlots);\n }\n\n /**\n * Releases all the \"unused\" video slots.\n */\n private releaseUnusedVideoSlots() {\n this.slots.video.unused.forEach((slot) => this.receiveSlotManager.releaseSlot(slot));\n this.slots.video.unused.length = 0;\n }\n\n /**\n * Allocates receive slots to all active speaker video panes\n * in the current selected layout.\n *\n * Allocation tries to keep the same order of the slots between the previous\n * layout and the new one. Sorting helps making sure that highest priority slots\n * go in the same order in the new layout.\n */\n private allocateSlotsToActiveSpeakerPaneGroups() {\n this.currentLayout?.activeSpeakerVideoPaneGroups\n // sorting in descending order based on group priority\n ?.sort((a, b) => (a.priority < b.priority ? 1 : -1))\n ?.forEach((group) => {\n this.receiveSlotAllocations.activeSpeaker[group.id] = {slots: []};\n\n for (let paneIndex = 0; paneIndex < group.numPanes; paneIndex += 1) {\n // allocate a slot from the \"unused\" list, by grabbing in same order (shift) as previous layout\n const freeSlot = this.slots.video.unused.shift();\n\n if (freeSlot) {\n this.slots.video.activeSpeaker.push(freeSlot);\n this.receiveSlotAllocations.activeSpeaker[group.id].slots.push(freeSlot);\n }\n }\n });\n }\n\n /**\n * Allocates receive slots to all receiver selected video panes\n * in the current selected layout\n */\n private allocateSlotsToReceiverSelectedVideoPaneGroups() {\n this.currentLayout?.memberVideoPanes?.forEach((memberPane) => {\n // check if there is existing slot for this csi\n const existingSlot = this.slots.video.receiverSelected.find(\n (slot) => slot.csi === memberPane.csi\n );\n\n const isExistingSlotAlreadyAllocated = Object.values(\n this.receiveSlotAllocations.receiverSelected\n ).includes(existingSlot);\n\n if (memberPane.csi !== undefined && existingSlot && !isExistingSlotAlreadyAllocated) {\n // found it, so use it\n this.receiveSlotAllocations.receiverSelected[memberPane.id] = existingSlot;\n } else {\n // allocate a slot from the \"unused\" list\n const freeSlot = this.slots.video.unused.pop();\n\n if (freeSlot) {\n this.slots.video.receiverSelected.push(freeSlot);\n this.receiveSlotAllocations.receiverSelected[memberPane.id] = freeSlot;\n }\n }\n });\n }\n\n /**\n * Ensures that we have enough slots for the current layout.\n */\n private async refillRequiredSlotsIfNeeded() {\n const requiredNumSlots = this.getRequiredNumVideoSlotsForLayout(this.currentLayout);\n const totalNumSlots =\n this.slots.video.unused.length +\n this.slots.video.activeSpeaker.length +\n this.slots.video.receiverSelected.length;\n\n if (totalNumSlots < requiredNumSlots) {\n let numSlotsToCreate = requiredNumSlots - totalNumSlots;\n\n while (numSlotsToCreate > 0) {\n // eslint-disable-next-line no-await-in-loop\n this.slots.video.unused.push(\n // eslint-disable-next-line no-await-in-loop\n await this.receiveSlotManager.allocateSlot(MediaType.VideoMain)\n );\n numSlotsToCreate -= 1;\n }\n }\n }\n\n /**\n * Move all active speaker slots to \"unused\"\n */\n private trimActiveSpeakerSlots() {\n this.slots.video.unused.push(...this.slots.video.activeSpeaker);\n this.slots.video.activeSpeaker.length = 0;\n }\n\n /**\n * Logs the state of the receive slots\n */\n private logReceieveSlots() {\n let logMessage = '';\n forEach(this.receiveSlotAllocations.activeSpeaker, (group, groupName) => {\n logMessage += `group: ${groupName}\\n${group.slots.map((slot) => slot.logString).join(' ')}`;\n });\n\n logMessage += '\\nreceiverSelected:\\n';\n forEach(this.receiveSlotAllocations.receiverSelected, (slot, key) => {\n logMessage += ` ${key}: ${slot.logString}\\n`;\n });\n\n LoggerProxy.logger.log(\n `RemoteMediaManager#updateVideoReceiveSlots --> receive slots updated: unused=${this.slots.video.unused.length}, activeSpeaker=${this.slots.video.activeSpeaker.length}, receiverSelected=${this.slots.video.receiverSelected.length}\\n${logMessage}`\n );\n }\n\n /**\n * Makes sure we have the right number of receive slots created for the current layout\n * and allocates them to the right video panes / pane groups\n *\n * @returns {Promise}\n */\n private async updateVideoReceiveSlots() {\n // move all active speaker slots to \"unused\"\n this.trimActiveSpeakerSlots();\n\n // move all no longer needed receiver-selected slots to \"unused\"\n this.trimReceiverSelectedSlots();\n\n // ensure we have enough total slots for current layout\n await this.refillRequiredSlotsIfNeeded();\n\n // allocate the slots to the right panes / pane groups\n // reset allocations\n this.receiveSlotAllocations = {activeSpeaker: {}, receiverSelected: {}};\n // allocate active speaker\n this.allocateSlotsToActiveSpeakerPaneGroups();\n // allocate receiver selected\n this.allocateSlotsToReceiverSelectedVideoPaneGroups();\n\n this.logReceieveSlots();\n\n // If this is the initial layout, there may be some \"unused\" slots left because of the preallocation\n // done in this.preallocateVideoReceiveSlots(), so release them now\n this.releaseUnusedVideoSlots();\n }\n\n /**\n * Creates new RemoteMedia and RemoteMediaGroup objects for the current layout\n * and sends the media requests for all of them.\n */\n private updateVideoRemoteMediaObjects() {\n // invalidate all the previous remote media objects and cancel their media requests\n this.invalidateCurrentRemoteMedia({\n audio: false,\n video: true,\n screenShareAudio: false,\n screenShareVideo: false,\n commit: false,\n });\n\n // create new remoteMediaGroup objects\n this.media.video.activeSpeakerGroups = {};\n this.media.video.memberPanes = {};\n\n for (const [groupId, group] of Object.entries(this.receiveSlotAllocations.activeSpeaker)) {\n const paneGroupInCurrentLayout = this.currentLayout?.activeSpeakerVideoPaneGroups?.find(\n (groupInLayout) => groupInLayout.id === groupId\n );\n\n if (paneGroupInCurrentLayout) {\n const mediaGroup = new RemoteMediaGroup(\n this.mediaRequestManagers.video,\n group.slots,\n paneGroupInCurrentLayout.priority,\n false,\n {\n preferLiveVideo: this.config.video.preferLiveVideo,\n resolution: paneGroupInCurrentLayout.size,\n }\n );\n\n this.media.video.activeSpeakerGroups[groupId] = mediaGroup;\n } else {\n // this should never happen, because this.receiveSlotAllocations are created based on current layout configuration\n LoggerProxy.logger.warn(\n `a group id ${groupId} from this.receiveSlotAllocations.activeSpeaker cannot be found in the current layout configuration`\n );\n }\n }\n\n // create new remoteMedia objects\n for (const [paneId, slot] of Object.entries(this.receiveSlotAllocations.receiverSelected)) {\n const paneInCurrentLayout = this.currentLayout?.memberVideoPanes?.find(\n (paneInLayout) => paneInLayout.id === paneId\n );\n\n if (paneInCurrentLayout) {\n const remoteMedia = new RemoteMedia(slot, this.mediaRequestManagers.video, {\n resolution: paneInCurrentLayout.size,\n });\n\n if (paneInCurrentLayout.csi) {\n remoteMedia.sendMediaRequest(paneInCurrentLayout.csi, false);\n }\n\n this.media.video.memberPanes[paneId] = remoteMedia;\n } else {\n // this should never happen, because this.receiveSlotAllocations are created based on current layout configuration\n LoggerProxy.logger.warn(\n `a pane id ${paneId} from this.receiveSlotAllocations.receiverSelected cannot be found in the current layout configuration`\n );\n }\n }\n\n this.mediaRequestManagers.video.commit();\n }\n\n /**\n * Checks if current layout requires a screen share.\n * If it does, it creates new RemoteMediaGroup object for screen share\n * and sends the media requests for it.\n * If it doesn't, it makes sure we clean up any RemoteMediaGroup objects\n * created earlier for screen share (for previous layout).\n */\n private updateScreenShareVideoRemoteMediaObject() {\n this.invalidateCurrentRemoteMedia({\n audio: false,\n video: false,\n screenShareAudio: false,\n screenShareVideo: true,\n commit: false,\n });\n\n this.media.screenShare.video = undefined;\n\n if (this.currentLayout?.screenShareVideo) {\n // we create a group of 1, because for screen share we need to use the \"active speaker\" policy\n this.media.screenShare.video = new RemoteMediaGroup(\n this.mediaRequestManagers.screenShareVideo,\n [this.slots.screenShare.video],\n 255,\n false,\n {resolution: this.currentLayout.screenShareVideo.size}\n );\n }\n\n this.mediaRequestManagers.screenShareVideo.commit();\n }\n\n /**\n * Invalidates all remote media objects belonging to currently selected layout\n */\n private invalidateCurrentRemoteMedia(options: {\n audio: boolean;\n video: boolean;\n screenShareAudio: boolean;\n screenShareVideo: boolean;\n commit: boolean;\n }) {\n const {audio, video, screenShareAudio, screenShareVideo, commit} = options;\n\n if (audio && this.media.audio) {\n this.media.audio.stop(commit);\n }\n if (video) {\n Object.values(this.media.video.activeSpeakerGroups).forEach((remoteMediaGroup) => {\n remoteMediaGroup.stop(false);\n });\n Object.values(this.media.video.memberPanes).forEach((remoteMedia) => {\n remoteMedia.stop(false);\n });\n if (commit) {\n this.mediaRequestManagers.video.commit();\n }\n }\n\n if (screenShareAudio && this.media.screenShare.audio) {\n this.media.screenShare.audio.stop(commit);\n }\n if (screenShareVideo && this.media.screenShare.video) {\n this.media.screenShare.video.stop(commit);\n }\n }\n\n /** emits Event.VideoLayoutChanged */\n private emitVideoLayoutChangedEvent() {\n // todo: at this point the receive slots might still be showing a participant from previous layout, we should\n // wait for our media requests to be fulfilled, but there is no API for that right now (we could wait for source updates\n // but in some cases they might never come, or would need to always make sure to use a new set of receiver slots)\n // for now it's fine to have it like this, we will re-evaluate if it needs improving after more testing\n\n this.emit(\n {\n file: 'multistream/remoteMediaManager',\n function: 'emitVideoLayoutChangedEvent',\n },\n Event.VideoLayoutChanged,\n {\n layoutId: this.currentLayoutId,\n activeSpeakerVideoPanes: this.media.video.activeSpeakerGroups,\n memberVideoPanes: this.media.video.memberPanes,\n screenShareVideo: this.media.screenShare.video?.getRemoteMedia()[0],\n }\n );\n }\n\n /**\n * Sets a new CSI on a given remote media object\n *\n * @param {RemoteMedia} remoteMedia remote Media object to modify\n * @param {CSI} csi new CSI value, can be null if we want to stop receiving media\n */\n public setRemoteVideoCsi(remoteMedia: RemoteMedia, csi: CSI | null) {\n if (!Object.values(this.media.video.memberPanes).includes(remoteMedia)) {\n throw new Error('remoteMedia not found');\n }\n\n if (csi) {\n remoteMedia.sendMediaRequest(csi, true);\n } else {\n remoteMedia.cancelMediaRequest(true);\n }\n }\n\n /**\n * Adds a new member video pane to the currently selected layout.\n *\n * Changes to the layout are lost after a layout change.\n *\n * @param {MemberVideoPane} newPane\n * @returns {Promise<RemoteMedia>}\n */\n public async addMemberVideoPane(newPane: MemberVideoPane): Promise<RemoteMedia> {\n if (!this.currentLayout) {\n throw new Error('There is no current layout selected, call start() first');\n }\n\n if (!this.currentLayout?.memberVideoPanes) {\n this.currentLayout.memberVideoPanes = [];\n }\n\n if (newPane.id in this.currentLayout.memberVideoPanes) {\n throw new Error(\n `duplicate pane id ${newPane.id} - this pane already exists in current layout's memberVideoPanes`\n );\n }\n\n this.currentLayout.memberVideoPanes.push(newPane);\n\n const receiveSlot = await this.receiveSlotManager.allocateSlot(MediaType.VideoMain);\n\n this.slots.video.receiverSelected.push(receiveSlot);\n\n const remoteMedia = new RemoteMedia(receiveSlot, this.mediaRequestManagers.video, {\n resolution: newPane.size,\n });\n\n if (newPane.csi) {\n remoteMedia.sendMediaRequest(newPane.csi, true);\n }\n\n this.media.video.memberPanes[newPane.id] = remoteMedia;\n\n return remoteMedia;\n }\n\n /**\n * Removes a member video pane from the currently selected layout.\n *\n * Changes to the layout are lost after a layout change.\n *\n * @param {PaneId} paneId pane id of the pane to remove\n * @returns {Promise<void>}\n */\n public removeMemberVideoPane(paneId: PaneId): Promise<void> {\n if (!this.currentLayout) {\n return Promise.reject(new Error('There is no current layout selected, call start() first'));\n }\n\n if (!this.currentLayout.memberVideoPanes?.find((pane) => pane.id === paneId)) {\n // pane id doesn't exist, so nothing to do\n LoggerProxy.logger.log(\n `RemoteMediaManager#removeMemberVideoPane --> removeMemberVideoPane() called for a non-existent paneId: ${paneId} (pane not found in currentLayout.memberVideoPanes)`\n );\n\n return Promise.resolve();\n }\n\n if (!this.media.video.memberPanes[paneId]) {\n // pane id doesn't exist, so nothing to do\n LoggerProxy.logger.log(\n `RemoteMediaManager#removeMemberVideoPane --> removeMemberVideoPane() called for a non-existent paneId: ${paneId} (pane not found in this.media.video.memberPanes)`\n );\n\n return Promise.resolve();\n }\n\n const remoteMedia = this.media.video.memberPanes[paneId];\n\n const receiveSlot = remoteMedia.getUnderlyingReceiveSlot();\n\n if (receiveSlot) {\n this.receiveSlotManager.releaseSlot(receiveSlot);\n\n const index = this.slots.video.receiverSelected.indexOf(receiveSlot);\n\n if (index >= 0) {\n this.slots.video.receiverSelected.splice(index, 1);\n }\n }\n remoteMedia.stop();\n\n delete this.media.video.memberPanes[paneId];\n delete this.currentLayout.memberVideoPanes?.[paneId];\n\n return Promise.resolve();\n }\n\n /**\n * Pins an active speaker remote media object to the given CSI value. From that moment\n * onwards the remote media will only play audio/video from that specific CSI until\n * unpinActiveSpeakerVideoPane() is called or current layout is changed.\n *\n * @param {RemoteMedia} remoteMedia remote media object reference\n * @param {CSI} csi CSI value to pin to, if undefined, then current CSI value is used\n */\n public pinActiveSpeakerVideoPane(remoteMedia: RemoteMedia, csi?: CSI): void {\n const remoteMediaGroup = Object.values(this.media.video.activeSpeakerGroups).find((group) =>\n group.includes(remoteMedia, 'unpinned')\n );\n\n if (!remoteMediaGroup) {\n throw new Error(\n 'remoteMedia not found among the unpinned remote media from any active speaker group'\n );\n }\n\n remoteMediaGroup.pin(remoteMedia, csi);\n }\n\n /**\n * Unpins a remote media object from the fixed CSI value it was pinned to.\n *\n * @param {RemoteMedia} remoteMedia remote media object reference\n */\n public unpinActiveSpeakerVideoPane(remoteMedia: RemoteMedia) {\n const remoteMediaGroup = Object.values(this.media.video.activeSpeakerGroups).find((group) =>\n group.includes(remoteMedia, 'pinned')\n );\n\n if (!remoteMediaGroup) {\n throw new Error(\n 'remoteMedia not found among the pinned remote media from any active speaker group'\n );\n }\n\n remoteMediaGroup.unpin(remoteMedia);\n }\n\n /**\n * Returns true if a given remote media object belongs to an active speaker group and has been pinned.\n * Throws an error if the remote media object doesn't belong to any active speaker remote media group.\n *\n * @param {RemoteMedia} remoteMedia remote media object\n * @returns {boolean}\n */\n public isPinned(remoteMedia: RemoteMedia) {\n const remoteMediaGroup = Object.values(this.media.video.activeSpeakerGroups).find((group) =>\n group.includes(remoteMedia)\n );\n\n if (!remoteMediaGroup) {\n throw new Error(\n 'remoteMedia not found among any remote media (pinned or unpinned) from any active speaker group'\n );\n }\n\n return remoteMediaGroup.isPinned(remoteMedia);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AAEA;AACA;AAEA;AAGA;AAAoD;AAAA;AA0CpD;;AAEA;AACA,IAAMA,cAA2B,GAAG;EAClCC,4BAA4B,EAAE,CAC5B;IACEC,EAAE,EAAE,MAAM;IACVC,QAAQ,EAAE,CAAC;IACXC,IAAI,EAAE,MAAM;IACZC,QAAQ,EAAE;EACZ,CAAC;AAEL,CAAC;;AAED;AACA,IAAMC,YAAyB,GAAG;EAChCL,4BAA4B,EAAE,CAC5B;IACEC,EAAE,EAAE,MAAM;IACVC,QAAQ,EAAE,CAAC;IACXC,IAAI,EAAE,MAAM;IACZC,QAAQ,EAAE;EACZ,CAAC;AAEL,CAAC;;AAED;AACA,IAAME,iBAA8B,GAAG;EACrCN,4BAA4B,EAAE,CAC5B;IACEC,EAAE,EAAE,YAAY;IAChBC,QAAQ,EAAE,CAAC;IACXC,IAAI,EAAE,OAAO;IACbC,QAAQ,EAAE;EACZ,CAAC,EACD;IACEH,EAAE,EAAE,0BAA0B;IAC9BC,QAAQ,EAAE,CAAC;IACXC,IAAI,EAAE,YAAY;IAClBC,QAAQ,EAAE;EACZ,CAAC;AAEL,CAAC;;AAED;AACA;AACA,IAAMG,yBAAsC,GAAG;EAC7CP,4BAA4B,EAAE,CAC5B;IACEC,EAAE,EAAE,wBAAwB;IAC5BC,QAAQ,EAAE,CAAC;IACXC,IAAI,EAAE,OAAO;IACbC,QAAQ,EAAE;EACZ,CAAC,EACD;IACEH,EAAE,EAAE,4BAA4B;IAChCC,QAAQ,EAA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,CAACD,WAAW,EAAE,UAAU,CAAC;MAAA,EACxC;MAED,IAAI,CAACH,gBAAgB,EAAE;QACrB,MAAM,IAAI5C,KAAK,CACb,qFAAqF,CACtF;MACH;MAEA4C,gBAAgB,CAACyE,GAAG,CAACtE,WAAW,EAAEjF,GAAG,CAAC;IACxC;;IAEA;AACF;AACA;AACA;AACA;EAJE;IAAA;IAAA,OAKA,qCAAmCiF,WAAwB,EAAE;MAC3D,IAAMH,gBAAgB,GAAG,qBAAc,IAAI,CAACzD,KAAK,CAACf,KAAK,CAACgB,mBAAmB,CAAC,CAACsF,IAAI,CAAC,UAACpE,KAAK;QAAA,OACtFA,KAAK,CAAC0C,QAAQ,CAACD,WAAW,EAAE,QAAQ,CAAC;MAAA,EACtC;MAED,IAAI,CAACH,gBAAgB,EAAE;QACrB,MAAM,IAAI5C,KAAK,CACb,mFAAmF,CACpF;MACH;MAEA4C,gBAAgB,CAAC0E,KAAK,CAACvE,WAAW,CAAC;IACrC;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE;IAAA;IAAA,OAOA,kBAAgBA,WAAwB,EAAE;MACxC,IAAMH,gBAAgB,GAAG,qBAAc,IAAI,CAACzD,KAAK,CAACf,KAAK,CAACgB,mBAAmB,CAAC,CAACsF,IAAI,CAAC,UAACpE,KAAK;QAAA,OACtFA,KAAK,CAAC0C,QAAQ,CAACD,WAAW,CAAC;MAAA,EAC5B;MAED,IAAI,CAACH,gBAAgB,EAAE;QACrB,MAAM,IAAI5C,KAAK,CACb,iGAAiG,CAClG;MACH;MAEA,OAAO4C,gBAAgB,CAAC2E,QAAQ,CAACxE,WAAW,CAAC;IAC/C;EAAC;EAAA;AAAA,EAp4BqCyE,oBAAW;AAAA"}
1
+ {"version":3,"names":["AllEqualLayout","activeSpeakerVideoPaneGroups","id","numPanes","size","priority","SingleLayout","OnePlusFiveLayout","TwoMainPlusSixSmallLayout","RemoteScreenShareWithSmallThumbnailsLayout","screenShareVideo","Stage2x2With6ThumbnailsLayout","memberVideoPanes","csi","undefined","DefaultConfiguration","audio","numOfActiveSpeakerStreams","numOfScreenShareStreams","video","preferLiveVideo","initialLayoutId","layouts","AllEqual","OnePlusFive","Single","Stage","ScreenShareView","Event","RemoteMediaManager","receiveSlotManager","mediaRequestManagers","config","started","media","activeSpeakerGroups","memberPanes","screenShare","checkConfigValidity","slots","unused","activeSpeaker","receiverSelected","receiveSlotAllocations","LoggerProxy","logger","log","Error","forEach","layout","groupIds","paneIds","groupPriorites","group","pane","createAudioMedia","createScreenShareReceiveSlots","createScreenShareAudioMedia","preallocateVideoReceiveSlots","setLayout","invalidateCurrentRemoteMedia","screenShareAudio","commit","slot","releaseSlot","length","push","releaseUnusedVideoSlots","currentLayout","currentLayoutId","activeSpeakerCount","reduce","sum","paneGroup","receiverSelectedCount","maxNumVideoPanesRequired","maxValue","Math","max","getRequiredNumVideoSlotsForLayout","allocateSlot","MediaType","VideoMain","layoutId","updateVideoReceiveSlots","updateVideoRemoteMediaObjects","updateScreenShareVideoRemoteMediaObject","emitVideoLayoutChangedEvent","activeSpeakerGroup","setPreferLiveVideo","remoteMediaCsis","remoteMediaGroup","groupRemoteMediaCsis","filter","remoteMedia","includes","setActiveSpeakerCsis","i","AudioMain","RemoteMediaGroup","emit","file","function","AudioCreated","AudioSlides","isAnyLayoutContainingScreenShareVideo","some","VideoSlides","ScreenShareAudioCreated","requiredCsis","memberVideoPane","isCsiNeededByCurrentLayout","notNeededReceiverSelectedSlots","sort","a","b","paneIndex","freeSlot","shift","memberPane","existingSlot","find","isExistingSlotAlreadyAllocated","pop","requiredNumSlots","totalNumSlots","numSlotsToCreate","logMessage","groupName","map","logString","join","key","logMainVideoReceiveSlots","logMainAudioReceiveSlots","logSlidesVideoReceiveSlots","logSlidesAudioReceiveSlots","trimActiveSpeakerSlots","trimReceiverSelectedSlots","refillRequiredSlotsIfNeeded","allocateSlotsToActiveSpeakerPaneGroups","allocateSlotsToReceiverSelectedVideoPaneGroups","groupId","paneGroupInCurrentLayout","groupInLayout","mediaGroup","resolution","warn","paneId","paneInCurrentLayout","paneInLayout","RemoteMedia","sendMediaRequest","options","stop","VideoLayoutChanged","activeSpeakerVideoPanes","getRemoteMedia","cancelMediaRequest","newPane","receiveSlot","reject","resolve","getUnderlyingReceiveSlot","index","indexOf","splice","pin","unpin","isPinned","EventsScope"],"sources":["remoteMediaManager.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {cloneDeep, forEach, remove} from 'lodash';\nimport {EventMap} from 'typed-emitter';\nimport {MediaType} from '@webex/internal-media-core';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport EventsScope from '../common/events/events-scope';\n\nimport {RemoteMedia, RemoteVideoResolution} from './remoteMedia';\nimport {ReceiveSlot, CSI} from './receiveSlot';\nimport {ReceiveSlotManager} from './receiveSlotManager';\nimport {RemoteMediaGroup} from './remoteMediaGroup';\nimport {MediaRequestManager} from './mediaRequestManager';\n\nexport type PaneSize = RemoteVideoResolution;\nexport type LayoutId = string;\nexport type PaneId = string;\nexport type PaneGroupId = string;\n\nexport interface ActiveSpeakerVideoPaneGroup {\n id: PaneGroupId;\n numPanes: number; // maximum number of panes in the group (actual number may be lower, if there are not enough participants in the meeting)\n size: PaneSize; // preferred size for all panes in the group\n priority: number; // 0-255 (255 = highest priority), each group must have a different priority from all other groups\n}\n\nexport interface MemberVideoPane {\n id: PaneId;\n size: PaneSize;\n csi?: CSI;\n}\n\nexport interface VideoLayout {\n screenShareVideo?: {\n size: PaneSize;\n };\n activeSpeakerVideoPaneGroups?: ActiveSpeakerVideoPaneGroup[]; // list of active speaker video pane groups\n memberVideoPanes?: MemberVideoPane[]; // list of video panes for specific members, CSI values can be changed later via setVideoPaneCsi()\n}\n\nexport interface Configuration {\n audio: {\n numOfActiveSpeakerStreams: number; // number of audio streams we want to receive\n numOfScreenShareStreams: number; // 1 should be enough, because in webex only 1 person at a time can be presenting screen share\n };\n video: {\n preferLiveVideo: boolean; // applies to all pane groups with active speaker policy\n initialLayoutId: LayoutId;\n\n layouts: {[key: LayoutId]: VideoLayout}; // a map of all available layouts, a layout can be set via setLayout() method\n };\n}\n\n/* Predefined layouts: */\n\n// An \"all equal\" grid, with size up to 3 x 3 = 9:\nconst AllEqualLayout: VideoLayout = {\n activeSpeakerVideoPaneGroups: [\n {\n id: 'main',\n numPanes: 9,\n size: 'best',\n priority: 255,\n },\n ],\n};\n\n// A layout with just a single remote active speaker video pane:\nconst SingleLayout: VideoLayout = {\n activeSpeakerVideoPaneGroups: [\n {\n id: 'main',\n numPanes: 1,\n size: 'best',\n priority: 255,\n },\n ],\n};\n\n// A layout with 1 big pane for the highest priority active speaker and 5 small panes for other active speakers:\nconst OnePlusFiveLayout: VideoLayout = {\n activeSpeakerVideoPaneGroups: [\n {\n id: 'mainBigOne',\n numPanes: 1,\n size: 'large',\n priority: 255,\n },\n {\n id: 'secondarySetOfSmallPanes',\n numPanes: 5,\n size: 'very small',\n priority: 254,\n },\n ],\n};\n\n// A layout with 2 big panes for 2 main active speakers and a strip of 6 small panes for other active speakers:\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst TwoMainPlusSixSmallLayout: VideoLayout = {\n activeSpeakerVideoPaneGroups: [\n {\n id: 'mainGroupWith2BigPanes',\n numPanes: 2,\n size: 'large',\n priority: 255,\n },\n {\n id: 'secondaryGroupOfSmallPanes',\n numPanes: 6,\n size: 'small',\n priority: 254,\n },\n ],\n};\n\n// A strip of 8 small video panes (thumbnails) displayed at the top of a remote screenshare:\nconst RemoteScreenShareWithSmallThumbnailsLayout: VideoLayout = {\n screenShareVideo: {size: 'best'},\n activeSpeakerVideoPaneGroups: [\n {\n id: 'thumbnails',\n numPanes: 8,\n size: 'thumbnail',\n priority: 255,\n },\n ],\n};\n\n// A staged layout with 4 pre-selected meeting participants in the main 2x2 grid and 6 small panes for other active speakers at the top:\nconst Stage2x2With6ThumbnailsLayout: VideoLayout = {\n activeSpeakerVideoPaneGroups: [\n {\n id: 'thumbnails',\n numPanes: 6,\n size: 'thumbnail',\n priority: 255,\n },\n ],\n memberVideoPanes: [\n {id: 'stage-1', size: 'medium', csi: undefined},\n {id: 'stage-2', size: 'medium', csi: undefined},\n {id: 'stage-3', size: 'medium', csi: undefined},\n {id: 'stage-4', size: 'medium', csi: undefined},\n ],\n};\n\n/**\n * Default configuration:\n * - uses 3 audio streams\n * - prefers active speakers with live video (e.g. are not audio only or video muted) over active speakers without live video\n * - has a few layouts defined, including 1 that contains remote screen share (ScreenShareView)\n */\nexport const DefaultConfiguration: Configuration = {\n audio: {\n numOfActiveSpeakerStreams: 3,\n numOfScreenShareStreams: 1,\n },\n video: {\n preferLiveVideo: true,\n initialLayoutId: 'AllEqual',\n\n layouts: {\n AllEqual: AllEqualLayout,\n OnePlusFive: OnePlusFiveLayout,\n Single: SingleLayout,\n Stage: Stage2x2With6ThumbnailsLayout,\n ScreenShareView: RemoteScreenShareWithSmallThumbnailsLayout,\n },\n },\n};\n\nexport enum Event {\n // events for audio streams\n AudioCreated = 'AudioCreated',\n ScreenShareAudioCreated = 'ScreenShareAudioCreated',\n\n // events for video streams\n VideoLayoutChanged = 'VideoLayoutChanged',\n}\n\nexport interface VideoLayoutChangedEventData {\n layoutId: LayoutId;\n activeSpeakerVideoPanes: {\n [key: PaneGroupId]: RemoteMediaGroup;\n };\n memberVideoPanes: {[key: PaneId]: RemoteMedia};\n screenShareVideo?: RemoteMedia;\n}\nexport interface Events extends EventMap {\n // audio\n [Event.AudioCreated]: (audio: RemoteMediaGroup) => void;\n [Event.ScreenShareAudioCreated]: (screenShareAudio: RemoteMediaGroup) => void;\n\n // video\n [Event.VideoLayoutChanged]: (data: VideoLayoutChangedEventData) => void;\n}\n\n/**\n * A helper class that manages all remote audio/video streams in order to achieve a predefined set of layouts.\n * It also creates a fixed number of audio streams and these don't change during the meeting.\n *\n * Things that RemoteMediaManager does:\n * - owns the receive slots (creates them when needed, and re-uses them when switching layouts)\n * - constructs appropriate RemoteMedia and RemoteMediaGroup objects and sends appropriate mediaRequests\n */\nexport class RemoteMediaManager extends EventsScope {\n private config: Configuration;\n\n private started: boolean;\n\n private receiveSlotManager: ReceiveSlotManager;\n\n private mediaRequestManagers: {\n audio: MediaRequestManager;\n video: MediaRequestManager;\n screenShareAudio: MediaRequestManager;\n screenShareVideo: MediaRequestManager;\n };\n\n private currentLayout?: VideoLayout;\n\n private slots: {\n audio: ReceiveSlot[];\n screenShare: {\n audio: ReceiveSlot[];\n video?: ReceiveSlot;\n };\n video: {\n unused: ReceiveSlot[];\n activeSpeaker: ReceiveSlot[];\n receiverSelected: ReceiveSlot[];\n };\n };\n\n private media: {\n audio?: RemoteMediaGroup;\n video: {\n activeSpeakerGroups: {\n [key: PaneGroupId]: RemoteMediaGroup;\n };\n memberPanes: {[key: PaneId]: RemoteMedia};\n };\n screenShare: {\n audio?: RemoteMediaGroup;\n video?: RemoteMediaGroup;\n };\n };\n\n private receiveSlotAllocations: {\n activeSpeaker: {[key: PaneGroupId]: {slots: ReceiveSlot[]}};\n receiverSelected: {[key: PaneId]: ReceiveSlot};\n };\n\n private currentLayoutId?: LayoutId;\n\n /**\n * Constructor\n *\n * @param {ReceiveSlotManager} receiveSlotManager\n * @param {{audio: MediaRequestManager, video: mediaRequestManagers}} mediaRequestManagers\n * @param {Configuration} config Configuration describing what video layouts to use during the meeting\n */\n constructor(\n receiveSlotManager: ReceiveSlotManager,\n mediaRequestManagers: {\n audio: MediaRequestManager;\n video: MediaRequestManager;\n screenShareAudio: MediaRequestManager;\n screenShareVideo: MediaRequestManager;\n },\n config: Configuration = DefaultConfiguration\n ) {\n super();\n this.started = false;\n this.config = config;\n this.receiveSlotManager = receiveSlotManager;\n this.mediaRequestManagers = mediaRequestManagers;\n this.media = {\n audio: undefined,\n video: {\n activeSpeakerGroups: {},\n memberPanes: {},\n },\n screenShare: {\n audio: undefined,\n video: undefined,\n },\n };\n\n this.checkConfigValidity();\n\n this.slots = {\n audio: [],\n screenShare: {\n audio: [],\n video: undefined,\n },\n video: {\n unused: [],\n activeSpeaker: [],\n receiverSelected: [],\n },\n };\n\n this.receiveSlotAllocations = {activeSpeaker: {}, receiverSelected: {}};\n\n LoggerProxy.logger.log(\n `RemoteMediaManager#constructor --> RemoteMediaManager created with config: ${JSON.stringify(\n this.config\n )}`\n );\n }\n\n /**\n * Checks if configuration is valid, throws an error if it's not\n */\n private checkConfigValidity() {\n if (!(this.config.video.initialLayoutId in this.config.video.layouts)) {\n throw new Error(\n `invalid config: initialLayoutId \"${this.config.video.initialLayoutId}\" doesn't match any of the layouts`\n );\n }\n\n // check if each layout is valid\n Object.values(this.config.video.layouts).forEach((layout) => {\n const groupIds = {};\n const paneIds = {};\n const groupPriorites = {};\n\n layout.activeSpeakerVideoPaneGroups?.forEach((group) => {\n if (groupIds[group.id]) {\n throw new Error(\n `invalid config: duplicate active speaker video pane group id: ${group.id}`\n );\n }\n groupIds[group.id] = true;\n\n if (groupPriorites[group.priority]) {\n throw new Error(\n `invalid config: multiple active speaker video pane groups have same priority: ${group.priority}`\n );\n }\n groupPriorites[group.priority] = true;\n });\n\n layout.memberVideoPanes?.forEach((pane) => {\n if (paneIds[pane.id]) {\n throw new Error(`invalid config: duplicate member video pane id: ${pane.id}`);\n }\n paneIds[pane.id] = true;\n });\n });\n }\n\n /**\n * Starts the RemoteMediaManager.\n *\n * @returns {Promise}\n */\n public async start() {\n if (this.started) {\n throw new Error('start() failure: already started');\n }\n this.started = true;\n\n await this.createAudioMedia();\n\n await this.createScreenShareReceiveSlots();\n this.createScreenShareAudioMedia();\n\n await this.preallocateVideoReceiveSlots();\n\n await this.setLayout(this.config.video.initialLayoutId);\n }\n\n /**\n * Releases all the used resources (like allocated receive slots). This function needs\n * to be called when we leave the meeting, etc.\n */\n public stop() {\n // invalidate all remoteMedia objects\n this.invalidateCurrentRemoteMedia({\n audio: true,\n video: true,\n screenShareAudio: true,\n screenShareVideo: true,\n commit: true,\n });\n\n // release all audio receive slots\n this.slots.audio.forEach((slot) => this.receiveSlotManager.releaseSlot(slot));\n this.slots.audio.length = 0;\n\n // release screen share slots\n this.slots.screenShare.audio.forEach((slot) => this.receiveSlotManager.releaseSlot(slot));\n this.slots.screenShare.audio.length = 0;\n if (this.slots.screenShare.video) {\n this.receiveSlotManager.releaseSlot(this.slots.screenShare.video);\n this.slots.screenShare.video = undefined;\n }\n\n // release video slots\n this.receiveSlotAllocations = {activeSpeaker: {}, receiverSelected: {}};\n\n this.slots.video.unused.push(...this.slots.video.activeSpeaker);\n this.slots.video.activeSpeaker.length = 0;\n\n this.slots.video.unused.push(...this.slots.video.receiverSelected);\n this.slots.video.receiverSelected.length = 0;\n\n this.releaseUnusedVideoSlots();\n\n this.currentLayout = undefined;\n this.currentLayoutId = undefined;\n this.started = false;\n }\n\n /**\n * Returns the total number of main video panes required for a given layout\n *\n * @param {VideoLayout} layout\n * @returns {number}\n */\n private getRequiredNumVideoSlotsForLayout(layout?: VideoLayout) {\n if (!layout) {\n return 0;\n }\n\n const activeSpeakerCount =\n layout.activeSpeakerVideoPaneGroups?.reduce(\n (sum, paneGroup) => sum + paneGroup.numPanes,\n 0\n ) || 0;\n\n const receiverSelectedCount = layout.memberVideoPanes?.length || 0;\n\n return activeSpeakerCount + receiverSelectedCount;\n }\n\n /**\n * Allocates the maximum number of panes that any of the configured layouts will require.\n * We do this at the beginning, because it's more efficient (much faster) then allocating receive slots\n * later, after the SDP exchange was done.\n */\n private async preallocateVideoReceiveSlots() {\n const maxNumVideoPanesRequired = Object.values(this.config.video.layouts).reduce(\n (maxValue, layout) => Math.max(maxValue, this.getRequiredNumVideoSlotsForLayout(layout)),\n 0\n );\n\n while (this.slots.video.unused.length < maxNumVideoPanesRequired) {\n // eslint-disable-next-line no-await-in-loop\n this.slots.video.unused.push(\n // eslint-disable-next-line no-await-in-loop\n await this.receiveSlotManager.allocateSlot(MediaType.VideoMain)\n );\n }\n }\n\n /**\n * Changes the layout (triggers Event.VideoLayoutChanged)\n *\n * @param {LayoutId} layoutId new layout id\n * @returns {Promise}\n */\n public async setLayout(layoutId: LayoutId) {\n if (!(layoutId in this.config.video.layouts)) {\n throw new Error(\n `invalid layoutId: \"${layoutId}\" doesn't match any of the configured layouts`\n );\n }\n if (!this.started) {\n throw new Error('setLayout() called before start()');\n }\n LoggerProxy.logger.log(`RemoteMediaManager#setLayout --> new layout selected: ${layoutId}`);\n\n this.currentLayoutId = layoutId;\n this.currentLayout = cloneDeep(this.config.video.layouts[this.currentLayoutId]);\n\n await this.updateVideoReceiveSlots();\n this.updateVideoRemoteMediaObjects();\n this.updateScreenShareVideoRemoteMediaObject();\n this.emitVideoLayoutChangedEvent();\n }\n\n /**\n * Returns the currently selected layout id\n *\n * @returns {LayoutId}\n */\n public getLayoutId(): LayoutId | undefined {\n return this.currentLayoutId;\n }\n\n /**\n * sets the preferLiveVideo\n */\n public setPreferLiveVideo(preferLiveVideo: boolean) {\n LoggerProxy.logger.log(\n `RemoteMediaManager#setPreferLiveVideo --> setPreferLiveVideo is called to set preferLiveVideo to ${preferLiveVideo}`\n );\n this.config.video.preferLiveVideo = preferLiveVideo;\n Object.values(this.media.video.activeSpeakerGroups).forEach((activeSpeakerGroup) => {\n activeSpeakerGroup.setPreferLiveVideo(preferLiveVideo, false);\n });\n this.mediaRequestManagers.video.commit();\n }\n\n /**\n * Sets CSIs for multiple RemoteMedia instances belonging to 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 */\n public setActiveSpeakerCsis(remoteMediaCsis: {remoteMedia: RemoteMedia; csi?: number}[]) {\n Object.values(this.media.video.activeSpeakerGroups).forEach((remoteMediaGroup) => {\n const groupRemoteMediaCsis = remoteMediaCsis.filter(({remoteMedia}) =>\n remoteMediaGroup.includes(remoteMedia)\n );\n if (groupRemoteMediaCsis.length > 0) {\n remoteMediaGroup.setActiveSpeakerCsis(groupRemoteMediaCsis, false);\n }\n });\n this.mediaRequestManagers.video.commit();\n }\n\n /**\n * Creates the audio slots\n */\n private async createAudioMedia() {\n // create the audio receive slots\n for (let i = 0; i < this.config.audio.numOfActiveSpeakerStreams; i += 1) {\n // eslint-disable-next-line no-await-in-loop\n const slot = await this.receiveSlotManager.allocateSlot(MediaType.AudioMain);\n\n this.slots.audio.push(slot);\n }\n\n // create a remote media group\n this.media.audio = new RemoteMediaGroup(\n this.mediaRequestManagers.audio,\n this.slots.audio,\n 255,\n true\n );\n\n this.emit(\n {file: 'multistream/remoteMediaManager', function: 'createAudioMedia'},\n Event.AudioCreated,\n this.media.audio\n );\n }\n\n /**\n * Creates receive slots required for receiving screen share audio and video\n */\n private async createScreenShareReceiveSlots() {\n // audio\n for (let i = 0; i < this.config.audio.numOfScreenShareStreams; i += 1) {\n // eslint-disable-next-line no-await-in-loop\n const slot = await this.receiveSlotManager.allocateSlot(MediaType.AudioSlides);\n\n this.slots.screenShare.audio.push(slot);\n }\n\n // video\n const isAnyLayoutContainingScreenShareVideo = Object.values(this.config.video.layouts).some(\n (layout) => !!layout.screenShareVideo\n );\n\n if (isAnyLayoutContainingScreenShareVideo) {\n this.slots.screenShare.video = await this.receiveSlotManager.allocateSlot(\n MediaType.VideoSlides\n );\n }\n }\n\n /**\n * Creates RemoteMedia objects for screen share\n */\n private createScreenShareAudioMedia() {\n if (this.slots.screenShare.audio.length > 0) {\n this.media.screenShare.audio = new RemoteMediaGroup(\n this.mediaRequestManagers.screenShareAudio,\n this.slots.screenShare.audio,\n 255,\n true\n );\n\n this.emit(\n {file: 'multistream/remoteMediaManager', function: 'createScreenShareAudioMedia'},\n Event.ScreenShareAudioCreated,\n this.media.screenShare.audio\n );\n }\n }\n\n /**\n * Goes over all receiver-selected slots and keeps only the ones that are required by a given layout,\n * the rest are all moved to the \"unused\" list\n */\n private trimReceiverSelectedSlots() {\n const requiredCsis = {};\n\n // fill requiredCsis with all the CSIs that the given layout requires\n this.currentLayout?.memberVideoPanes?.forEach((memberVideoPane) => {\n if (memberVideoPane.csi !== undefined) {\n requiredCsis[memberVideoPane.csi] = true;\n }\n });\n\n const isCsiNeededByCurrentLayout = (csi?: CSI): boolean => {\n if (csi === undefined) {\n return false;\n }\n\n return !!requiredCsis[csi];\n };\n\n // keep receiverSelected slots that match our new requiredCsis, move the rest of receiverSelected slots to unused\n const notNeededReceiverSelectedSlots = remove(\n this.slots.video.receiverSelected,\n (slot) => isCsiNeededByCurrentLayout(slot.csi) === false\n );\n\n this.slots.video.unused.push(...notNeededReceiverSelectedSlots);\n }\n\n /**\n * Releases all the \"unused\" video slots.\n */\n private releaseUnusedVideoSlots() {\n this.slots.video.unused.forEach((slot) => this.receiveSlotManager.releaseSlot(slot));\n this.slots.video.unused.length = 0;\n }\n\n /**\n * Allocates receive slots to all active speaker video panes\n * in the current selected layout.\n *\n * Allocation tries to keep the same order of the slots between the previous\n * layout and the new one. Sorting helps making sure that highest priority slots\n * go in the same order in the new layout.\n */\n private allocateSlotsToActiveSpeakerPaneGroups() {\n this.currentLayout?.activeSpeakerVideoPaneGroups\n // sorting in descending order based on group priority\n ?.sort((a, b) => (a.priority < b.priority ? 1 : -1))\n ?.forEach((group) => {\n this.receiveSlotAllocations.activeSpeaker[group.id] = {slots: []};\n\n for (let paneIndex = 0; paneIndex < group.numPanes; paneIndex += 1) {\n // allocate a slot from the \"unused\" list, by grabbing in same order (shift) as previous layout\n const freeSlot = this.slots.video.unused.shift();\n\n if (freeSlot) {\n this.slots.video.activeSpeaker.push(freeSlot);\n this.receiveSlotAllocations.activeSpeaker[group.id].slots.push(freeSlot);\n }\n }\n });\n }\n\n /**\n * Allocates receive slots to all receiver selected video panes\n * in the current selected layout\n */\n private allocateSlotsToReceiverSelectedVideoPaneGroups() {\n this.currentLayout?.memberVideoPanes?.forEach((memberPane) => {\n // check if there is existing slot for this csi\n const existingSlot = this.slots.video.receiverSelected.find(\n (slot) => slot.csi === memberPane.csi\n );\n\n const isExistingSlotAlreadyAllocated = Object.values(\n this.receiveSlotAllocations.receiverSelected\n ).includes(existingSlot);\n\n if (memberPane.csi !== undefined && existingSlot && !isExistingSlotAlreadyAllocated) {\n // found it, so use it\n this.receiveSlotAllocations.receiverSelected[memberPane.id] = existingSlot;\n } else {\n // allocate a slot from the \"unused\" list\n const freeSlot = this.slots.video.unused.pop();\n\n if (freeSlot) {\n this.slots.video.receiverSelected.push(freeSlot);\n this.receiveSlotAllocations.receiverSelected[memberPane.id] = freeSlot;\n }\n }\n });\n }\n\n /**\n * Ensures that we have enough slots for the current layout.\n */\n private async refillRequiredSlotsIfNeeded() {\n const requiredNumSlots = this.getRequiredNumVideoSlotsForLayout(this.currentLayout);\n const totalNumSlots =\n this.slots.video.unused.length +\n this.slots.video.activeSpeaker.length +\n this.slots.video.receiverSelected.length;\n\n if (totalNumSlots < requiredNumSlots) {\n let numSlotsToCreate = requiredNumSlots - totalNumSlots;\n\n while (numSlotsToCreate > 0) {\n // eslint-disable-next-line no-await-in-loop\n this.slots.video.unused.push(\n // eslint-disable-next-line no-await-in-loop\n await this.receiveSlotManager.allocateSlot(MediaType.VideoMain)\n );\n numSlotsToCreate -= 1;\n }\n }\n }\n\n /**\n * Move all active speaker slots to \"unused\"\n */\n private trimActiveSpeakerSlots() {\n this.slots.video.unused.push(...this.slots.video.activeSpeaker);\n this.slots.video.activeSpeaker.length = 0;\n }\n\n /**\n * Logs the state of the receive slots\n */\n private logMainVideoReceiveSlots() {\n let logMessage = '';\n forEach(this.receiveSlotAllocations.activeSpeaker, (group, groupName) => {\n logMessage += `\\ngroup: ${groupName}\\n${group.slots\n .map((slot) => slot.logString)\n .join(', ')}`;\n });\n\n logMessage += '\\nreceiverSelected:\\n';\n forEach(this.receiveSlotAllocations.receiverSelected, (slot, key) => {\n logMessage += ` ${key}: ${slot.logString}\\n`;\n });\n\n LoggerProxy.logger.log(\n `RemoteMediaManager#logMainVideoReceiveSlots --> MAIN VIDEO receive slots: unused=${this.slots.video.unused.length}, activeSpeaker=${this.slots.video.activeSpeaker.length}, receiverSelected=${this.slots.video.receiverSelected.length}${logMessage}`\n );\n }\n\n /** logs main audio slots */\n private logMainAudioReceiveSlots() {\n LoggerProxy.logger.log(\n `RemoteMediaManager#logMainAudioReceiveSlots --> MAIN AUDIO receive slots: ${this.slots.audio\n .map((slot) => slot.logString)\n .join(', ')}`\n );\n }\n\n /** logs slides video slots */\n private logSlidesVideoReceiveSlots() {\n LoggerProxy.logger.log(\n `RemoteMediaManager#logSlidesVideoReceiveSlots --> SLIDES VIDEO receive slot: ${this.slots.screenShare.video?.logString}`\n );\n }\n\n /** logs slides audio slots */\n private logSlidesAudioReceiveSlots() {\n LoggerProxy.logger.log(\n `RemoteMediaManager#logSlidesAudioReceiveSlots --> SLIDES AUDIO receive slots: ${this.slots.screenShare.audio\n .map((slot) => slot.logString)\n .join(', ')}`\n );\n }\n\n /** Logs all current receive slots */\n public logAllReceiveSlots() {\n this.logMainVideoReceiveSlots();\n this.logMainAudioReceiveSlots();\n this.logSlidesVideoReceiveSlots();\n this.logSlidesAudioReceiveSlots();\n }\n\n /**\n * Makes sure we have the right number of receive slots created for the current layout\n * and allocates them to the right video panes / pane groups\n *\n * @returns {Promise}\n */\n private async updateVideoReceiveSlots() {\n // move all active speaker slots to \"unused\"\n this.trimActiveSpeakerSlots();\n\n // move all no longer needed receiver-selected slots to \"unused\"\n this.trimReceiverSelectedSlots();\n\n // ensure we have enough total slots for current layout\n await this.refillRequiredSlotsIfNeeded();\n\n // allocate the slots to the right panes / pane groups\n // reset allocations\n this.receiveSlotAllocations = {activeSpeaker: {}, receiverSelected: {}};\n // allocate active speaker\n this.allocateSlotsToActiveSpeakerPaneGroups();\n // allocate receiver selected\n this.allocateSlotsToReceiverSelectedVideoPaneGroups();\n\n this.logMainVideoReceiveSlots();\n\n // If this is the initial layout, there may be some \"unused\" slots left because of the preallocation\n // done in this.preallocateVideoReceiveSlots(), so release them now\n this.releaseUnusedVideoSlots();\n }\n\n /**\n * Creates new RemoteMedia and RemoteMediaGroup objects for the current layout\n * and sends the media requests for all of them.\n */\n private updateVideoRemoteMediaObjects() {\n // invalidate all the previous remote media objects and cancel their media requests\n this.invalidateCurrentRemoteMedia({\n audio: false,\n video: true,\n screenShareAudio: false,\n screenShareVideo: false,\n commit: false,\n });\n\n // create new remoteMediaGroup objects\n this.media.video.activeSpeakerGroups = {};\n this.media.video.memberPanes = {};\n\n for (const [groupId, group] of Object.entries(this.receiveSlotAllocations.activeSpeaker)) {\n const paneGroupInCurrentLayout = this.currentLayout?.activeSpeakerVideoPaneGroups?.find(\n (groupInLayout) => groupInLayout.id === groupId\n );\n\n if (paneGroupInCurrentLayout) {\n const mediaGroup = new RemoteMediaGroup(\n this.mediaRequestManagers.video,\n group.slots,\n paneGroupInCurrentLayout.priority,\n false,\n {\n preferLiveVideo: this.config.video.preferLiveVideo,\n resolution: paneGroupInCurrentLayout.size,\n }\n );\n\n this.media.video.activeSpeakerGroups[groupId] = mediaGroup;\n } else {\n // this should never happen, because this.receiveSlotAllocations are created based on current layout configuration\n LoggerProxy.logger.warn(\n `a group id ${groupId} from this.receiveSlotAllocations.activeSpeaker cannot be found in the current layout configuration`\n );\n }\n }\n\n // create new remoteMedia objects\n for (const [paneId, slot] of Object.entries(this.receiveSlotAllocations.receiverSelected)) {\n const paneInCurrentLayout = this.currentLayout?.memberVideoPanes?.find(\n (paneInLayout) => paneInLayout.id === paneId\n );\n\n if (paneInCurrentLayout) {\n const remoteMedia = new RemoteMedia(slot, this.mediaRequestManagers.video, {\n resolution: paneInCurrentLayout.size,\n });\n\n if (paneInCurrentLayout.csi) {\n remoteMedia.sendMediaRequest(paneInCurrentLayout.csi, false);\n }\n\n this.media.video.memberPanes[paneId] = remoteMedia;\n } else {\n // this should never happen, because this.receiveSlotAllocations are created based on current layout configuration\n LoggerProxy.logger.warn(\n `a pane id ${paneId} from this.receiveSlotAllocations.receiverSelected cannot be found in the current layout configuration`\n );\n }\n }\n\n this.mediaRequestManagers.video.commit();\n }\n\n /**\n * Checks if current layout requires a screen share.\n * If it does, it creates new RemoteMediaGroup object for screen share\n * and sends the media requests for it.\n * If it doesn't, it makes sure we clean up any RemoteMediaGroup objects\n * created earlier for screen share (for previous layout).\n */\n private updateScreenShareVideoRemoteMediaObject() {\n this.invalidateCurrentRemoteMedia({\n audio: false,\n video: false,\n screenShareAudio: false,\n screenShareVideo: true,\n commit: false,\n });\n\n this.media.screenShare.video = undefined;\n\n if (this.currentLayout?.screenShareVideo) {\n // we create a group of 1, because for screen share we need to use the \"active speaker\" policy\n this.media.screenShare.video = new RemoteMediaGroup(\n this.mediaRequestManagers.screenShareVideo,\n [this.slots.screenShare.video],\n 255,\n false,\n {resolution: this.currentLayout.screenShareVideo.size}\n );\n }\n\n this.mediaRequestManagers.screenShareVideo.commit();\n }\n\n /**\n * Invalidates all remote media objects belonging to currently selected layout\n */\n private invalidateCurrentRemoteMedia(options: {\n audio: boolean;\n video: boolean;\n screenShareAudio: boolean;\n screenShareVideo: boolean;\n commit: boolean;\n }) {\n const {audio, video, screenShareAudio, screenShareVideo, commit} = options;\n\n if (audio && this.media.audio) {\n this.media.audio.stop(commit);\n }\n if (video) {\n Object.values(this.media.video.activeSpeakerGroups).forEach((remoteMediaGroup) => {\n remoteMediaGroup.stop(false);\n });\n Object.values(this.media.video.memberPanes).forEach((remoteMedia) => {\n remoteMedia.stop(false);\n });\n if (commit) {\n this.mediaRequestManagers.video.commit();\n }\n }\n\n if (screenShareAudio && this.media.screenShare.audio) {\n this.media.screenShare.audio.stop(commit);\n }\n if (screenShareVideo && this.media.screenShare.video) {\n this.media.screenShare.video.stop(commit);\n }\n }\n\n /** emits Event.VideoLayoutChanged */\n private emitVideoLayoutChangedEvent() {\n // todo: at this point the receive slots might still be showing a participant from previous layout, we should\n // wait for our media requests to be fulfilled, but there is no API for that right now (we could wait for source updates\n // but in some cases they might never come, or would need to always make sure to use a new set of receiver slots)\n // for now it's fine to have it like this, we will re-evaluate if it needs improving after more testing\n\n this.emit(\n {\n file: 'multistream/remoteMediaManager',\n function: 'emitVideoLayoutChangedEvent',\n },\n Event.VideoLayoutChanged,\n {\n layoutId: this.currentLayoutId,\n activeSpeakerVideoPanes: this.media.video.activeSpeakerGroups,\n memberVideoPanes: this.media.video.memberPanes,\n screenShareVideo: this.media.screenShare.video?.getRemoteMedia()[0],\n }\n );\n }\n\n /**\n * Sets a new CSI on a given remote media object\n *\n * @param {RemoteMedia} remoteMedia remote Media object to modify\n * @param {CSI} csi new CSI value, can be null if we want to stop receiving media\n */\n public setRemoteVideoCsi(remoteMedia: RemoteMedia, csi: CSI | null) {\n if (!Object.values(this.media.video.memberPanes).includes(remoteMedia)) {\n throw new Error('remoteMedia not found');\n }\n\n if (csi) {\n remoteMedia.sendMediaRequest(csi, true);\n } else {\n remoteMedia.cancelMediaRequest(true);\n }\n }\n\n /**\n * Adds a new member video pane to the currently selected layout.\n *\n * Changes to the layout are lost after a layout change.\n *\n * @param {MemberVideoPane} newPane\n * @returns {Promise<RemoteMedia>}\n */\n public async addMemberVideoPane(newPane: MemberVideoPane): Promise<RemoteMedia> {\n if (!this.currentLayout) {\n throw new Error('There is no current layout selected, call start() first');\n }\n\n if (!this.currentLayout?.memberVideoPanes) {\n this.currentLayout.memberVideoPanes = [];\n }\n\n if (newPane.id in this.currentLayout.memberVideoPanes) {\n throw new Error(\n `duplicate pane id ${newPane.id} - this pane already exists in current layout's memberVideoPanes`\n );\n }\n\n this.currentLayout.memberVideoPanes.push(newPane);\n\n const receiveSlot = await this.receiveSlotManager.allocateSlot(MediaType.VideoMain);\n\n this.slots.video.receiverSelected.push(receiveSlot);\n\n const remoteMedia = new RemoteMedia(receiveSlot, this.mediaRequestManagers.video, {\n resolution: newPane.size,\n });\n\n if (newPane.csi) {\n remoteMedia.sendMediaRequest(newPane.csi, true);\n }\n\n this.media.video.memberPanes[newPane.id] = remoteMedia;\n\n return remoteMedia;\n }\n\n /**\n * Removes a member video pane from the currently selected layout.\n *\n * Changes to the layout are lost after a layout change.\n *\n * @param {PaneId} paneId pane id of the pane to remove\n * @returns {Promise<void>}\n */\n public removeMemberVideoPane(paneId: PaneId): Promise<void> {\n if (!this.currentLayout) {\n return Promise.reject(new Error('There is no current layout selected, call start() first'));\n }\n\n if (!this.currentLayout.memberVideoPanes?.find((pane) => pane.id === paneId)) {\n // pane id doesn't exist, so nothing to do\n LoggerProxy.logger.log(\n `RemoteMediaManager#removeMemberVideoPane --> removeMemberVideoPane() called for a non-existent paneId: ${paneId} (pane not found in currentLayout.memberVideoPanes)`\n );\n\n return Promise.resolve();\n }\n\n if (!this.media.video.memberPanes[paneId]) {\n // pane id doesn't exist, so nothing to do\n LoggerProxy.logger.log(\n `RemoteMediaManager#removeMemberVideoPane --> removeMemberVideoPane() called for a non-existent paneId: ${paneId} (pane not found in this.media.video.memberPanes)`\n );\n\n return Promise.resolve();\n }\n\n const remoteMedia = this.media.video.memberPanes[paneId];\n\n const receiveSlot = remoteMedia.getUnderlyingReceiveSlot();\n\n if (receiveSlot) {\n this.receiveSlotManager.releaseSlot(receiveSlot);\n\n const index = this.slots.video.receiverSelected.indexOf(receiveSlot);\n\n if (index >= 0) {\n this.slots.video.receiverSelected.splice(index, 1);\n }\n }\n remoteMedia.stop();\n\n delete this.media.video.memberPanes[paneId];\n delete this.currentLayout.memberVideoPanes?.[paneId];\n\n return Promise.resolve();\n }\n\n /**\n * Pins an active speaker remote media object to the given CSI value. From that moment\n * onwards the remote media will only play audio/video from that specific CSI until\n * unpinActiveSpeakerVideoPane() is called or current layout is changed.\n *\n * @param {RemoteMedia} remoteMedia remote media object reference\n * @param {CSI} csi CSI value to pin to, if undefined, then current CSI value is used\n */\n public pinActiveSpeakerVideoPane(remoteMedia: RemoteMedia, csi?: CSI): void {\n const remoteMediaGroup = Object.values(this.media.video.activeSpeakerGroups).find((group) =>\n group.includes(remoteMedia, 'unpinned')\n );\n\n if (!remoteMediaGroup) {\n throw new Error(\n 'remoteMedia not found among the unpinned remote media from any active speaker group'\n );\n }\n\n remoteMediaGroup.pin(remoteMedia, csi);\n }\n\n /**\n * Unpins a remote media object from the fixed CSI value it was pinned to.\n *\n * @param {RemoteMedia} remoteMedia remote media object reference\n */\n public unpinActiveSpeakerVideoPane(remoteMedia: RemoteMedia) {\n const remoteMediaGroup = Object.values(this.media.video.activeSpeakerGroups).find((group) =>\n group.includes(remoteMedia, 'pinned')\n );\n\n if (!remoteMediaGroup) {\n throw new Error(\n 'remoteMedia not found among the pinned remote media from any active speaker group'\n );\n }\n\n remoteMediaGroup.unpin(remoteMedia);\n }\n\n /**\n * Returns true if a given remote media object belongs to an active speaker group and has been pinned.\n * Throws an error if the remote media object doesn't belong to any active speaker remote media group.\n *\n * @param {RemoteMedia} remoteMedia remote media object\n * @returns {boolean}\n */\n public isPinned(remoteMedia: RemoteMedia) {\n const remoteMediaGroup = Object.values(this.media.video.activeSpeakerGroups).find((group) =>\n group.includes(remoteMedia)\n );\n\n if (!remoteMediaGroup) {\n throw new Error(\n 'remoteMedia not found among any remote media (pinned or unpinned) from any active speaker group'\n );\n }\n\n return remoteMediaGroup.isPinned(remoteMedia);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AAEA;AACA;AAEA;AAGA;AAAoD;AAAA;AA0CpD;;AAEA;AACA,IAAMA,cAA2B,GAAG;EAClCC,4BAA4B,EAAE,CAC5B;IACEC,EAAE,EAAE,MAAM;IACVC,QAAQ,EAAE,CAAC;IACXC,IAAI,EAAE,MAAM;IACZC,QAAQ,EAAE;EACZ,CAAC;AAEL,CAAC;;AAED;AACA,IAAMC,YAAyB,GAAG;EAChCL,4BAA4B,EAAE,CAC5B;IACEC,EAAE,EAAE,MAAM;IACVC,QAAQ,EAAE,CAAC;IACXC,IAAI,EAAE,MAAM;IACZC,QAAQ,EAAE;EACZ,CAAC;AAEL,CAAC;;AAED;AACA,IAAME,iBAA8B,GAAG;EACrCN,4BAA4B,EAAE,CAC5B;IACEC,EAAE,EAAE,YAAY;IAChBC,QAAQ,EAAE,CAAC;IACXC,IAAI,EAAE,OAAO;IACbC,QAAQ,EAAE;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UAACpE,KAAK;QAAA,OACtFA,KAAK,CAAC0C,QAAQ,CAACD,WAAW,EAAE,UAAU,CAAC;MAAA,EACxC;MAED,IAAI,CAACH,gBAAgB,EAAE;QACrB,MAAM,IAAI5C,KAAK,CACb,qFAAqF,CACtF;MACH;MAEA4C,gBAAgB,CAAC4E,GAAG,CAACzE,WAAW,EAAEjF,GAAG,CAAC;IACxC;;IAEA;AACF;AACA;AACA;AACA;EAJE;IAAA;IAAA,OAKA,qCAAmCiF,WAAwB,EAAE;MAC3D,IAAMH,gBAAgB,GAAG,qBAAc,IAAI,CAACzD,KAAK,CAACf,KAAK,CAACgB,mBAAmB,CAAC,CAACsF,IAAI,CAAC,UAACpE,KAAK;QAAA,OACtFA,KAAK,CAAC0C,QAAQ,CAACD,WAAW,EAAE,QAAQ,CAAC;MAAA,EACtC;MAED,IAAI,CAACH,gBAAgB,EAAE;QACrB,MAAM,IAAI5C,KAAK,CACb,mFAAmF,CACpF;MACH;MAEA4C,gBAAgB,CAAC6E,KAAK,CAAC1E,WAAW,CAAC;IACrC;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE;IAAA;IAAA,OAOA,kBAAgBA,WAAwB,EAAE;MACxC,IAAMH,gBAAgB,GAAG,qBAAc,IAAI,CAACzD,KAAK,CAACf,KAAK,CAACgB,mBAAmB,CAAC,CAACsF,IAAI,CAAC,UAACpE,KAAK;QAAA,OACtFA,KAAK,CAAC0C,QAAQ,CAACD,WAAW,CAAC;MAAA,EAC5B;MAED,IAAI,CAACH,gBAAgB,EAAE;QACrB,MAAM,IAAI5C,KAAK,CACb,iGAAiG,CAClG;MACH;MAEA,OAAO4C,gBAAgB,CAAC8E,QAAQ,CAAC3E,WAAW,CAAC;IAC/C;EAAC;EAAA;AAAA,EAz6BqC4E,oBAAW;AAAA"}
@@ -277,6 +277,7 @@ export declare const MEETING_REMOVED_REASON: {
277
277
  USER_ENDED_SHARE_STREAMS: string;
278
278
  NO_MEETINGS_TO_SYNC: string;
279
279
  MEETING_CONNECTION_FAILED: string;
280
+ LOCUS_DTO_SYNC_FAILED: string;
280
281
  };
281
282
  export declare const CALL_REMOVED_REASON: {
282
283
  CALL_INACTIVE: string;
@@ -385,7 +385,8 @@ export default class Meeting extends StatelessWebexPlugin {
385
385
  meetingJoinUrl: any;
386
386
  meetingNumber: any;
387
387
  meetingState: any;
388
- permissionToken: any;
388
+ permissionToken: string;
389
+ permissionTokenPayload: any;
389
390
  resourceId: any;
390
391
  resourceUrl: string;
391
392
  selfId: string;
@@ -759,10 +760,16 @@ export default class Meeting extends StatelessWebexPlugin {
759
760
  private updateMeetingActions;
760
761
  /**
761
762
  * Sets the self user policies based on the contents of the permission token
763
+ * @returns {void}
764
+ */
765
+ setSelfUserPolicies(): void;
766
+ /**
767
+ * Sets the permission token payload on the class instance
768
+ *
762
769
  * @param {String} permissionToken
763
770
  * @returns {void}
764
771
  */
765
- setSelfUserPolicies(permissionToken: string): void;
772
+ setPermissionTokenPayload(permissionToken: string): void;
766
773
  /**
767
774
  * Sets the sip uri on the class instance
768
775
  * uses meeting info as precedence
@@ -1516,4 +1523,11 @@ export default class Meeting extends StatelessWebexPlugin {
1516
1523
  * @returns {Promise}
1517
1524
  */
1518
1525
  unpublishStreams(streams: LocalStream[]): Promise<void>;
1526
+ /**
1527
+ * Gets the time left in seconds till the permission token expires
1528
+ * (from the time the function has been fired)
1529
+ *
1530
+ * @returns {number} time left in seconds
1531
+ */
1532
+ getPermissionTokenTimeLeftInSec(): number | undefined;
1519
1533
  }
@@ -10,7 +10,7 @@ export type RoapRequest = {
10
10
  reachability: any;
11
11
  sequence?: any;
12
12
  joinCookie: any;
13
- ipVersion: IP_VERSION;
13
+ ipVersion?: IP_VERSION;
14
14
  };
15
15
  export type LocalMuteRequest = {
16
16
  type: 'LocalMute';
@@ -21,7 +21,6 @@ export type LocalMuteRequest = {
21
21
  audioMuted?: boolean;
22
22
  videoMuted?: boolean;
23
23
  };
24
- ipVersion: IP_VERSION;
25
24
  };
26
25
  export type Request = RoapRequest | LocalMuteRequest;
27
26
  export type Config = {
@@ -44,6 +44,7 @@ export default class MeetingRequest extends StatelessWebexPlugin {
44
44
  sipUri: string;
45
45
  deviceUrl: string;
46
46
  locusUrl: string;
47
+ locusClusterUrl: string;
47
48
  resourceId: string;
48
49
  correlationId: string;
49
50
  ensureConversation: boolean;
@@ -60,7 +61,7 @@ export default class MeetingRequest extends StatelessWebexPlugin {
60
61
  locale?: string;
61
62
  deviceCapabilities?: Array<string>;
62
63
  liveAnnotationSupported: boolean;
63
- ipVersion: IP_VERSION;
64
+ ipVersion?: IP_VERSION;
64
65
  }): Promise<any>;
65
66
  /**
66
67
  * Send a request to refresh the captcha
@@ -1,10 +1,18 @@
1
- import { SELF_POLICY } from '../constants';
1
+ import { SELF_POLICY, IP_VERSION } from '../constants';
2
2
  declare const MeetingUtil: {
3
3
  parseLocusJoin: (response: any) => any;
4
4
  remoteUpdateAudioVideo: (meeting: any, audioMuted?: boolean, videoMuted?: boolean) => any;
5
5
  hasOwner: (info: any) => any;
6
6
  isOwnerSelf: (owner: any, selfId: any) => boolean;
7
7
  isPinOrGuest: (err: any) => boolean;
8
+ /**
9
+ * Returns the current state of knowledge about whether we are on an ipv4-only or ipv6-only or mixed (ipv4 and ipv6) network.
10
+ * The return value matches the possible values of "ipver" parameter used by the backend APIs.
11
+ *
12
+ * @param {Object} webex webex instance
13
+ * @returns {IP_VERSION|undefined} ipver value to be passed to the backend APIs or undefined if we should not pass any value to the backend
14
+ */
15
+ getIpVersion(webex: any): IP_VERSION | undefined;
8
16
  joinMeeting: (meeting: any, options: any) => any;
9
17
  cleanUp: (meeting: any) => any;
10
18
  disconnectPhoneAudio: (meeting: any, phoneUrl: any) => any;
@@ -37,6 +37,7 @@ declare const BEHAVIORAL_METRICS: {
37
37
  PEERCONNECTION_FAILURE: string;
38
38
  INVALID_ICE_CANDIDATE: string;
39
39
  UPLOAD_LOGS_FAILURE: string;
40
+ UPLOAD_LOGS_SUCCESS: string;
40
41
  RECEIVE_TRANSCRIPTION_FAILURE: string;
41
42
  FETCH_MEETING_INFO_V1_SUCCESS: string;
42
43
  FETCH_MEETING_INFO_V1_FAILURE: string;
@@ -51,5 +52,7 @@ declare const BEHAVIORAL_METRICS: {
51
52
  MOVE_FROM_FAILURE: string;
52
53
  TURN_DISCOVERY_FAILURE: string;
53
54
  MEETING_INFO_POLICY_ERROR: string;
55
+ LOCUS_DELTA_SYNC_FAILED: string;
56
+ LOCUS_DELTA_OUT_OF_ORDER: string;
54
57
  };
55
58
  export { BEHAVIORAL_METRICS as default };
@@ -199,7 +199,15 @@ export declare class RemoteMediaManager extends EventsScope {
199
199
  /**
200
200
  * Logs the state of the receive slots
201
201
  */
202
- private logReceieveSlots;
202
+ private logMainVideoReceiveSlots;
203
+ /** logs main audio slots */
204
+ private logMainAudioReceiveSlots;
205
+ /** logs slides video slots */
206
+ private logSlidesVideoReceiveSlots;
207
+ /** logs slides audio slots */
208
+ private logSlidesAudioReceiveSlots;
209
+ /** Logs all current receive slots */
210
+ logAllReceiveSlots(): void;
203
211
  /**
204
212
  * Makes sure we have the right number of receive slots created for the current layout
205
213
  * and allocates them to the right video panes / pane groups
@@ -1,7 +1,6 @@
1
1
  /*!
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
- import { IP_VERSION } from '../constants';
5
4
  export type ICECandidateResult = {
6
5
  clusterId: string;
7
6
  elapsed?: string | null;
@@ -37,11 +36,6 @@ export default class Reachability {
37
36
  * @memberof Reachability
38
37
  */
39
38
  isAnyClusterReachable(): Promise<boolean>;
40
- /**
41
- * Returns what we know about the IP version of the networks we're connected to.
42
- * @returns {IP_VERSION}
43
- */
44
- getIpVersion(): IP_VERSION;
45
39
  /**
46
40
  * Generate peerConnection config settings
47
41
  * @param {object} cluster
@@ -25,7 +25,7 @@ declare class ReachabilityRequest {
25
25
  * @param {IP_VERSION} ipVersion information about current ip network we're on
26
26
  * @returns {Promise}
27
27
  */
28
- getClusters: (ipVersion: IP_VERSION) => Promise<{
28
+ getClusters: (ipVersion?: IP_VERSION) => Promise<{
29
29
  clusters: ClusterList;
30
30
  joinCookie: any;
31
31
  }>;
@@ -22,6 +22,7 @@ export default class RoapRequest extends StatelessWebexPlugin {
22
22
  * @param {String} options.mediaId
23
23
  * @param {String} options.correlationId
24
24
  * @param {String} options.meetingId
25
+ * @param {IP_VERSION} options.ipVersion only required for offers
25
26
  * @returns {Promise} returns the response/failure of the request
26
27
  */
27
28
  sendRoap(options: {
@@ -29,7 +30,7 @@ export default class RoapRequest extends StatelessWebexPlugin {
29
30
  locusSelfUrl: string;
30
31
  mediaId: string;
31
32
  meetingId: string;
32
- ipVersion: IP_VERSION;
33
+ ipVersion?: IP_VERSION;
33
34
  locusMediaRequest?: LocusMediaRequest;
34
35
  }): Promise<{
35
36
  mediaConnections: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/plugin-meetings",
3
- "version": "3.0.0-stream-classes.4",
3
+ "version": "3.0.0-stream-classes.5",
4
4
  "description": "",
5
5
  "license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
6
6
  "contributors": [
package/src/constants.ts CHANGED
@@ -388,6 +388,7 @@ export const MEETING_REMOVED_REASON = {
388
388
  USER_ENDED_SHARE_STREAMS: 'USER_ENDED_SHARE_STREAMS', // user triggered stop share
389
389
  NO_MEETINGS_TO_SYNC: 'NO_MEETINGS_TO_SYNC', // After the syncMeeting no meeting exists
390
390
  MEETING_CONNECTION_FAILED: 'MEETING_CONNECTION_FAILED', // meeting failed to connect due to ice failures or firewall issue
391
+ LOCUS_DTO_SYNC_FAILED: 'LOCUS_DTO_SYNC_FAILED', // failed to get any Locus DTO for that meeting
391
392
  };
392
393
 
393
394
  // One one one calls ends for the following reasons
@@ -25,6 +25,8 @@ import ControlsUtils from './controlsUtils';
25
25
  import EmbeddedAppsUtils from './embeddedAppsUtils';
26
26
  import MediaSharesUtils from './mediaSharesUtils';
27
27
  import LocusDeltaParser from './parser';
28
+ import Metrics from '../metrics';
29
+ import BEHAVIORAL_METRICS from '../metrics/constants';
28
30
 
29
31
  /**
30
32
  * @description LocusInfo extends ChildEmitter to convert locusInfo info a private emitter to parent object
@@ -110,6 +112,37 @@ export default class LocusInfo extends EventsScope {
110
112
  // return value ignored on purpose
111
113
  meeting.meetingRequest
112
114
  .getLocusDTO({url})
115
+ .catch((e) => {
116
+ if (isDelta) {
117
+ LoggerProxy.logger.info(
118
+ 'Locus-info:index#doLocusSync --> delta sync failed, falling back to full sync'
119
+ );
120
+
121
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.LOCUS_DELTA_SYNC_FAILED, {
122
+ correlationId: meeting.correlationId,
123
+ url,
124
+ reason: e.message,
125
+ errorName: e.name,
126
+ stack: e.stack,
127
+ code: e.code,
128
+ });
129
+
130
+ isDelta = false;
131
+
132
+ return meeting.meetingRequest.getLocusDTO({url: meeting.locusUrl}).catch((err) => {
133
+ LoggerProxy.logger.info(
134
+ 'Locus-info:index#doLocusSync --> fallback full sync failed, destroying the meeting'
135
+ );
136
+ this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
137
+ throw err;
138
+ });
139
+ }
140
+ LoggerProxy.logger.info(
141
+ 'Locus-info:index#doLocusSync --> fallback full sync failed, destroying the meeting'
142
+ );
143
+ this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
144
+ throw e;
145
+ })
113
146
  .then((res) => {
114
147
  if (isDelta) {
115
148
  if (!isEmpty(res.body)) {
@@ -122,8 +155,6 @@ export default class LocusInfo extends EventsScope {
122
155
  } else {
123
156
  meeting.locusInfo.onFullLocus(res.body);
124
157
  }
125
- })
126
- .finally(() => {
127
158
  // Notify parser to resume processing delta events.
128
159
  // Any deltas in the queue that have now been superseded by this sync will simply be ignored
129
160
  this.locusParser.resume();
@@ -3,6 +3,9 @@ import {difference} from 'lodash';
3
3
  import SortedQueue from '../common/queue';
4
4
  import LoggerProxy from '../common/logs/logger-proxy';
5
5
 
6
+ import Metrics from '../metrics';
7
+ import BEHAVIORAL_METRICS from '../metrics/constants';
8
+
6
9
  const MAX_OOO_DELTA_COUNT = 5; // when we receive an out-of-order delta and the queue builds up to MAX_OOO_DELTA_COUNT, we do a sync with Locus
7
10
  const OOO_DELTA_WAIT_TIME = 10000; // [ms] minimum wait time before we do a sync if we get out-of-order deltas
8
11
  const OOO_DELTA_WAIT_TIME_RANDOM_DELAY = 5000; // [ms] max random delay added to OOO_DELTA_WAIT_TIME
@@ -293,6 +296,10 @@ export default class Parser {
293
296
  // the incoming locus has baseSequence from the future, so it is out-of-order,
294
297
  // we are missing 1 or more locus that should be in front of it, we need to wait for it
295
298
  comparison = WAIT;
299
+
300
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.LOCUS_DELTA_OUT_OF_ORDER, {
301
+ stack: new Error().stack,
302
+ });
296
303
  }
297
304
  break;
298
305
  default: