-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plugin-meetings): add brb logic for plugin meetings when current user steps away or returns #4031
base: next
Are you sure you want to change the base?
feat(plugin-meetings): add brb logic for plugin meetings when current user steps away or returns #4031
Changes from 2 commits
2ff58a4
46229db
94bd9a1
f26421f
926ba58
0b543cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see a changeset for selfUtils test file. Could we add them as well? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3303,6 +3303,20 @@ export default class Meeting extends StatelessWebexPlugin { | |
} | ||
}); | ||
|
||
this.locusInfo.on(LOCUSINFO.EVENTS.SELF_MEETING_BRB_CHANGED, (payload) => { | ||
Trigger.trigger( | ||
this, | ||
{ | ||
file: 'meeting/index', | ||
function: 'setUpLocusInfoSelfListener', | ||
}, | ||
EVENT_TRIGGERS.MEETING_SELF_BRB_UPDATE, | ||
{ | ||
payload, | ||
} | ||
); | ||
}); | ||
|
||
this.locusInfo.on(LOCUSINFO.EVENTS.SELF_ROLES_CHANGED, (payload) => { | ||
const isModeratorOrCohost = | ||
payload.newRoles?.includes(SELF_ROLES.MODERATOR) || | ||
|
@@ -3505,6 +3519,50 @@ export default class Meeting extends StatelessWebexPlugin { | |
return this.members.admitMembers(memberIds, locusUrls); | ||
} | ||
|
||
/** | ||
* Manages be right back status updates for the current participant. | ||
* | ||
* @param {boolean} enabled - Indicates whether the user enabled brb or not. | ||
* @returns {Promise<void>} resolves when the brb status is updated or does nothing if not in a multistream meeting. | ||
* @throws {Error} - Throws an error if the request fails. | ||
*/ | ||
public async beRightBack(enabled: boolean): Promise<void> { | ||
if (!this.isMultistream) { | ||
const errorMessage = 'Meeting:index#beRightBack --> Not a multistream meeting'; | ||
const error = new Error(errorMessage); | ||
|
||
LoggerProxy.logger.error(error); | ||
|
||
return Promise.reject(error); | ||
} | ||
|
||
if (!this.mediaProperties.webrtcMediaConnection) { | ||
const errorMessage = 'Meeting:index#beRightBack --> WebRTC media connection is not defined'; | ||
const error = new Error(errorMessage); | ||
|
||
LoggerProxy.logger.error(error); | ||
|
||
return Promise.reject(error); | ||
} | ||
|
||
// this logic should be applied only to multistream meetings | ||
return this.meetingRequest | ||
.sendBrb({ | ||
enabled, | ||
locusUrl: this.locusUrl, | ||
deviceUrl: this.deviceUrl, | ||
selfId: this.selfId, | ||
}) | ||
.then(() => { | ||
this.sendSlotManager.setSourceStateOverride(MediaType.VideoMain, enabled ? 'away' : null); | ||
}) | ||
.catch((error) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not able to find a test for this catch block. Could you point me to the test where this is being tested? |
||
LoggerProxy.logger.error('Meeting:index#beRightBack --> Error ', error); | ||
|
||
return Promise.reject(error); | ||
}); | ||
} | ||
|
||
/** | ||
* Remove the member from the meeting, boot them | ||
* @param {String} memberId | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ import { | |
ANNOTATION, | ||
IP_VERSION, | ||
} from '../constants'; | ||
import {SendReactionOptions, ToggleReactionsOptions} from './request.type'; | ||
import {SendReactionOptions, BrbOptions, ToggleReactionsOptions} from './request.type'; | ||
import MeetingUtil from './util'; | ||
import {AnnotationInfo} from '../annotation/annotation.types'; | ||
|
||
|
@@ -916,4 +916,29 @@ export default class MeetingRequest extends StatelessWebexPlugin { | |
uri: locusUrl, | ||
}); | ||
} | ||
|
||
/** | ||
* Sends a request to set be right back status. | ||
* | ||
* @param {Object} options - The options for brb request. | ||
* @param {boolean} options.enabled - Whether brb status is enabled. | ||
* @param {string} options.locusUrl - The URL of the locus. | ||
* @param {string} options.deviceUrl - The URL of the device. | ||
* @param {string} options.selfId - The ID of the participant. | ||
* @returns {Promise} | ||
*/ | ||
sendBrb({enabled, locusUrl, deviceUrl, selfId}: BrbOptions) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would |
||
const uri = `${locusUrl}/${PARTICIPANT}/${selfId}/${CONTROLS}`; | ||
|
||
return this.locusDeltaRequest({ | ||
method: HTTP_VERBS.PATCH, | ||
uri, | ||
body: { | ||
brb: { | ||
enabled, | ||
deviceUrl, | ||
}, | ||
}, | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were we observing any issues with this logic, leading to the change?