Video.Video

Access the Video API Consumer. You can use an instance of the Video class (you can obtain one via createClient) to subscribe to the Video events.

Events

You can use this object to subscribe to the following events.

  • room.started:

Emitted when a room session is started. Your event handler receives an object which is an instance of RoomSession. Example:

const client = await createClient(...)
client.video.on('room.started', async (roomSession) => {
    console.log(roomSession.name)
})
await client.connect()
  • room.ended:

Emitted when a room session ends. Your event handler receives an object which is an instance of RoomSession.

const client = await createClient(...)
client.video.on('room.ended', async (roomSession) => {
    console.log(roomSession.name)
})
await client.connect()

Methods

off

off<T>(event, fn?): EmitterContract<RealTimeVideoApiEvents>

Type parameters

NameType
Textends "room.started" | "room.ended"

Parameters

NameType
eventT
fn?(...args: ArgumentMap<RealTimeVideoApiEvents>[Extract<T, "room.started" | "room.ended">]) => void

Returns

EmitterContract<RealTimeVideoApiEvents>


on

on<T>(event, fn): EmitterContract<RealTimeVideoApiEvents>

Type parameters

NameType
Textends "room.started" | "room.ended"

Parameters

NameType
eventT
fn(...args: ArgumentMap<RealTimeVideoApiEvents>[Extract<T, "room.started" | "room.ended">]) => void

Returns

EmitterContract<RealTimeVideoApiEvents>


once

once<T>(event, fn): EmitterContract<RealTimeVideoApiEvents>

Type parameters

NameType
Textends "room.started" | "room.ended"

Parameters

NameType
eventT
fn(...args: ArgumentMap<RealTimeVideoApiEvents>[Extract<T, "room.started" | "room.ended">]) => void

Returns

EmitterContract<RealTimeVideoApiEvents>