Video.Client

You can use instances of this class to subscribe to video events. Please see VideoClientApiEvents for the full list of events you can subscribe to.

Example

const video = new Video.Client({
  project: '<project-id>',
  token: '<project-token>'
})

video.on('room.started', async (roomSession) => {
  console.log("Room started")
});

video.on('room.ended', async (roomSession) => {
  console.log("Room ended")
});

Constructors

constructor

new Client(opts)

Parameters

NameTypeDescription
optsObject-
opts.projectstring

SignalWire project id, e.g. a10d8a9f-2166-4e82-56ff-118bc3a4840f

opts.tokenstring

SignalWire project token, e.g. PT9e5660c101cd140a1c93a0197640a369cf5f16975a0079c9

Methods

off

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

Type parameters

NameType
Textends keyof RealTimeVideoApiEventsDocs

Parameters

NameType
eventT
fn?(...args: ArgumentMap<RealTimeVideoApiEventsDocs>[Extract<T, keyof RealTimeVideoApiEventsDocs>]) => void

Returns

EmitterContract<RealTimeVideoApiEventsDocs>


on

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

Type parameters

NameType
Textends keyof RealTimeVideoApiEventsDocs

Parameters

NameType
eventT
fn(...args: ArgumentMap<RealTimeVideoApiEventsDocs>[Extract<T, keyof RealTimeVideoApiEventsDocs>]) => void

Returns

EmitterContract<RealTimeVideoApiEventsDocs>


once

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

Type parameters

NameType
Textends keyof RealTimeVideoApiEventsDocs

Parameters

NameType
eventT
fn(...args: ArgumentMap<RealTimeVideoApiEventsDocs>[Extract<T, keyof RealTimeVideoApiEventsDocs>]) => void

Returns

EmitterContract<RealTimeVideoApiEventsDocs>


removeAllListeners

removeAllListeners<T>(event?): EmitterContract<RealTimeVideoApiEventsDocs>

Type parameters

NameType
Textends keyof RealTimeVideoApiEventsDocs

Parameters

NameType
event?T

Returns

EmitterContract<RealTimeVideoApiEventsDocs>