Skip to content

Commit

Permalink
fix: added method for getting the meeting with active webrtc connecti…
Browse files Browse the repository at this point in the history
…on (#3307)
  • Loading branch information
marcin-bazyl authored Jan 15, 2024
1 parent fbc3335 commit 9414240
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/@webex/plugin-meetings/src/meetings/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,17 @@ export default class MeetingCollection extends Collection {

return null;
}

/**
* Gets the meeting that has a webrtc media connection
* NOTE: this function assumes there is no more than 1 such meeting
*
* @returns {Meeting} first meeting found, else undefined
* @public
* @memberof MeetingCollection
*/
public getActiveWebrtcMeeting() {
// @ts-ignore
return find(this.meetings, (meeting) => meeting.mediaProperties.webrtcMediaConnection);
}
}
11 changes: 11 additions & 0 deletions packages/@webex/plugin-meetings/src/meetings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1467,4 +1467,15 @@ export default class Meetings extends WebexPlugin {
getLogger() {
return LoggerProxy.get();
}

/**
* Returns the first meeting it finds that has the webrtc media connection created.
* Useful for debugging in the console.
*
* @private
* @returns {Meeting} Meeting object that has a webrtc media connection, else undefined
*/
getActiveWebrtcMeeting() {
return this.meetingCollection.getActiveWebrtcMeeting();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,17 @@ describe('plugin-meetings', () => {
breakouts: {url: 'url', isActiveBreakout: true}, id: uuid1});
});
});

describe('#getActiveWebrtcMeeting', () => {
it('returns the meeting with a webrtc media connection', () => {
const activeMeeting = {value: 'test3', id: uuid.v4(), mediaProperties: { webrtcMediaConnection: 'something'}};

meetingCollection.meetings.test = {value: 'test', id: uuid1, mediaProperties: {}};
meetingCollection.meetings.test2 = {value: 'test2', id: uuid2, mediaProperties: {}};
meetingCollection.meetings.test3 = activeMeeting;

assert.equal(meetingCollection.getActiveWebrtcMeeting(), activeMeeting);
})
})
});
});

0 comments on commit 9414240

Please sign in to comment.