Controls the media of a participant in a media session if certain conditions are met.
The options for controlling media.
The ID of the participant to control.
The name of the participant to control.
The type of media to control.
The socket instance for communication.
List of co-host responsibilities.
List of participants in the session.
The current member attempting to control media.
The level of the current member.
Optional function to show alerts.
The co-host information.
The name of the room.
A promise that resolves when the media control operation is complete.
Will log an error message if the operation fails.
const options = { participantId: '12345', participantName: 'John Doe', type: 'audio', socket: socketInstance, coHostResponsibility: [{ name: 'media', value: true }], participants: participantList, member: 'currentMember', islevel: '2', showAlert: showAlertFunction, coHost: 'coHostName', roomName: 'Room A',};controlMediaService.controlMedia(options) .then(() => { console.log('Media control action completed'); }) .catch((error) => { console.error('Error controlling media:', error); }); Copy
const options = { participantId: '12345', participantName: 'John Doe', type: 'audio', socket: socketInstance, coHostResponsibility: [{ name: 'media', value: true }], participants: participantList, member: 'currentMember', islevel: '2', showAlert: showAlertFunction, coHost: 'coHostName', roomName: 'Room A',};controlMediaService.controlMedia(options) .then(() => { console.log('Media control action completed'); }) .catch((error) => { console.error('Error controlling media:', error); });
Controls the media of a participant in a media session if certain conditions are met.
Param: options
The options for controlling media.
Param: options.participantId
The ID of the participant to control.
Param: options.participantName
The name of the participant to control.
Param: options.type
The type of media to control.
Param: options.socket
The socket instance for communication.
Param: options.coHostResponsibility
List of co-host responsibilities.
Param: options.participants
List of participants in the session.
Param: options.member
The current member attempting to control media.
Param: options.islevel
The level of the current member.
Param: options.showAlert
Optional function to show alerts.
Param: options.coHost
The co-host information.
Param: options.roomName
The name of the room.
Returns
A promise that resolves when the media control operation is complete.
Throws
Will log an error message if the operation fails.
Example