Live JavaScript v1
Live JavaScript
Live
JavaScript
Home
/
Live
/
JavaScript
/
SDK

Receive events on a live event

Add event listeners so that participants can be notified of actions taken in the live event such as the host entering or exiting the event, muting or unmuting their microphones, stopping or resuming their videos, and the updates of live event states.

/*
export type LiveEventEventMap = {
    hostMutedAudio: { args: [LiveEvent, Host] };
    hostUnmutedAudio: { args: [LiveEvent, Host] };
    hostStartedVideo: { args: [LiveEvent, Host] };
    hostStoppedVideo: { args: [LiveEvent, Host] };
    liveEventReady: { args: [LiveEvent] };
    liveEventStarted: { args: [LiveEvent] };
    liveEventEnded: { args: [LiveEvent] };
    liveEventUpdated: { args: [LiveEvent] };
    hostEntered: { args: [LiveEvent, Host] };
    hostExited: { args: [LiveEvent, Host] };
    hostConnected: { args: [LiveEvent, Host] };
    hostDisconnected: { args: [LiveEvent, Host] };
    participantEntered: { args: [LiveEvent, Participant] };
    participantExited: { args: [LiveEvent, Participant] };
    customItemsUpdated: { args: [CustomItems, number] };
    customItemsDeleted: { args: [CustomItems, number] };
    disconnected: { args: [LiveEvent, Error] };
}
*/

liveEvent.on('hostMutedAudio', (liveEvent, host) => {
    console.log(`${host.hostId} muted audio.`);
})