From 963f849ff9bb7601ba7858edab3d6c46c3df0ce4 Mon Sep 17 00:00:00 2001 From: Christopher DuBois Date: Wed, 2 Oct 2024 08:42:49 -0700 Subject: [PATCH] feat(meetings): add meeting join time marker --- .../plugin-meetings/src/meeting/index.ts | 23 +++++++++++++++++++ .../test/unit/spec/meeting/index.js | 5 ++++ 2 files changed, 28 insertions(+) diff --git a/packages/@webex/plugin-meetings/src/meeting/index.ts b/packages/@webex/plugin-meetings/src/meeting/index.ts index daf9ed31b96..650f5cb193e 100644 --- a/packages/@webex/plugin-meetings/src/meeting/index.ts +++ b/packages/@webex/plugin-meetings/src/meeting/index.ts @@ -538,6 +538,7 @@ export default class Meeting extends StatelessWebexPlugin { id: string; isMultistream: boolean; locusUrl: string; + #isoLocalClientMeetingJoinTime?: string; mediaConnections: any[]; mediaId?: string; meetingFiniteStateMachine: any; @@ -1521,6 +1522,17 @@ export default class Meeting extends StatelessWebexPlugin { * @memberof Meeting */ this.iceCandidatesCount = 0; + + /** + * Start time of meeting as an ISO string + * based on browser time, so can only be used to compute durations client side + * undefined if meeting has not been joined, set once on meeting join, and not updated again + * @instance + * @type {string} + * @private + * @memberof Meeting + */ + this.#isoLocalClientMeetingJoinTime = undefined; } /** @@ -1569,6 +1581,15 @@ export default class Meeting extends StatelessWebexPlugin { this.callStateForMetrics.correlationId = correlationId; } + /** + * Getter - Returns isoLocalClientMeetingJoinTime + * This will be set once on meeting join, and not updated again + * @returns {string | undefined} + */ + get isoLocalClientMeetingJoinTime(): string | undefined { + return this.#isoLocalClientMeetingJoinTime; + } + /** * Set meeting info and trigger `MEETING_INFO_AVAILABLE` event * @param {any} info @@ -5235,6 +5256,8 @@ export default class Meeting extends StatelessWebexPlugin { // @ts-ignore this.webex.internal.device.meetingStarted(); + this.#isoLocalClientMeetingJoinTime = new Date().toISOString(); + LoggerProxy.logger.log('Meeting:index#join --> Success'); Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.JOIN_SUCCESS, { diff --git a/packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js b/packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js index 99bcb3a9cd9..2b947cfbdb6 100644 --- a/packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js +++ b/packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js @@ -331,6 +331,7 @@ describe('plugin-meetings', () => { assert.isNull(meeting.partner); assert.isNull(meeting.type); assert.isNull(meeting.owner); + assert.isUndefined(meeting.isoLocalClientMeetingJoinTime); assert.isNull(meeting.hostId); assert.isNull(meeting.policy); assert.instanceOf(meeting.meetingRequest, MeetingRequest); @@ -1587,6 +1588,10 @@ describe('plugin-meetings', () => { sandbox.stub(MeetingUtil, 'joinMeeting').returns(Promise.resolve(joinMeetingResult)); }); + afterEach(() => { + assert.exists(meeting.isoLocalClientMeetingJoinTime); + }); + it('should join the meeting and return promise', async () => { const join = meeting.join({pstnAudioType: 'dial-in'}); meeting.config.enableAutomaticLLM = true;