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 there are issues controlling the media or if participant is not found.
const options = {
participantId: '1234',
participantName: 'John Doe',
type: 'audio',
socket: socketInstance,
coHostResponsibility: [{ name: 'media', value: true }],
participants: participantList,
member: 'Admin',
islevel: '1',
showAlert: (alert) => console.log(alert.message),
coHost: 'CoHostName',
roomName: 'Room 1',
};
controlMedia(options)
.then(() => {
console.log('Media control operation completed successfully.');
})
.catch((error) => {
console.error('Error controlling media:', error);
});
Controls the media of a participant in a media session if certain conditions are met.