Live SDKs JavaScript v1
Live SDKs JavaScript
Live SDKs
JavaScript
Version 1

Receive events on a live event

Copy link

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] };
    participantCountChanged: { args: [LiveEvent, ParticipantCountInfo] };
    customItemsUpdated: { args: [CustomItems, number] };
    customItemsDeleted: { args: [CustomItems, number] };
    disconnected: { args: [LiveEvent, Error] };
}
*/

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