MediaSFU Angular
    Preparing search index...

    Class ModifyCoHostSettings

    Modifies the co-host settings for a given room.

    This method allows you to update the co-host for a chat room, set their responsibilities, and emit the relevant changes to the server. It also handles demo mode restrictions.

    The options for modifying co-host settings.

    The name of the room.

    Function to show an alert message.

    The participant selected to be co-host.

    The current co-host.

    The responsibilities assigned to the co-host.

    Function to update the visibility of the co-host modal.

    Function to update the co-host responsibility.

    Function to update the co-host.

    The socket instance for emitting events.

    A promise that resolves when the co-host settings have been modified.

    • If the room is in demo mode (room name starts with "d"), co-host cannot be added and an alert is shown.
    • If a valid participant is selected, they are set as the new co-host.
    • The co-host responsibility is updated.
    • A socket event is emitted to update the co-host information.
    • The co-host modal is closed after updating the settings.
    const options: ModifyCoHostSettingsOptions = {
    roomName: 'mainRoom',
    showAlert: (alert) => console.log(alert.message),
    selectedParticipant: 'JohnDoe',
    coHost: 'No coHost',
    coHostResponsibility: ['manage participants', 'start/stop recording'],
    updateIsCoHostModalVisible: (isVisible) => console.log('Co-host modal visible:', isVisible),
    updateCoHostResponsibility: (responsibility) => console.log('Updated co-host responsibility:', responsibility),
    updateCoHost: (coHost) => console.log('New co-host:', coHost),
    socket: socketInstance,
    };

    const modifyCoHostService = new ModifyCoHostSettings();
    await modifyCoHostService.modifyCoHostSettings(options);
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Modifies the co-host settings for a given room.

      Parameters

      • options: ModifyCoHostSettingsOptions

        The options for modifying co-host settings.

        • roomName: string
        • OptionalshowAlert?: ShowAlert
        • selectedParticipant: string
        • coHost: string
        • coHostResponsibility: CoHostResponsibility[]
        • updateIsCoHostModalVisible: (isVisible: boolean) => void
        • updateCoHostResponsibility: (coHostResponsibility: CoHostResponsibility[]) => void
        • updateCoHost: (coHost: string) => void
        • socket: Socket

      Returns Promise<void>

      A promise that resolves when the co-host settings have been modified.

      • If the room is in demo mode (room name starts with "d"), co-host cannot be added and an alert is shown.
      • If a valid participant is selected, they are set as the new co-host.
      • The co-host responsibility is updated.
      • A socket event is emitted to update the co-host information.
      • The co-host modal is closed after updating the settings.