Calls

calls

index

Properties

channel

the current call channel

tsstring

status

current call status

ts"connected" | "connecting" | "disconnected" | "checking"

tracks

local tracks published by active user

tsTracksByName

Methods

addTracks

tsaddTracks (tracks: TracksByName) : Promise<void> ;

add local tracks to call

emits track:add event

Parameters

tracks

local tracks

tsTracksByName
Returns
tsPromise<void>

addUsers

tsaddUsers (users: string[]) : Promise<Status> ;

add users to call, sends a newcall notification to users if they are online

emits user:add event

Parameters

users

an array of user ids to add to call

tsstring[]
Returns
tsPromise<Status>

configure

tsconfigure (config: CallConfig) : Promise<Status> ;

update channel configuration

emtts cnl:config event

Parameters

config

call channel configuration

tsCallConfig
Returns
tsPromise<Status>

create

tscreate (channelId: string, tracks?: TracksByName, config?: CallConfig) : Promise<Status> ;

create a new call channel

fails if call exists at channel id or user has no permissions to create call.

Parameters

channelId

channel id

tsstring
tracks ?

initial tracks

tsTracksByName
config ?

call configuration

tsCallConfig
Returns
tsPromise<Status>

delUsers

tsdelUsers (users: string[]) : Promise<Status> ;

delete | remove users from call. users removed this way will not be able to join unless added again

emits user:del event

Parameters

users

an array of user ids to delete

tsstring[]
Returns
tsPromise<Status>

delete

tsdelete (reason?: string) : Promise<Status> ;

delete call, disconnecting all active users, only the call owner (one who started it) can do this

emits cnl:delete event

Parameters

reason ?

optionally tell others the reason

tsstring
Returns
tsPromise<Status>

getUsers

tsgetUsers () : Promise<ActiveUser[]> ;

get active call users,

Returns

active users mapped with their active tracks and muted statuses

tsPromise<ActiveUser[]>

join

tsjoin (channelId: string, tracks?: TracksByName) : Promise<Status> ;

join an existing call

emits user:join event

Parameters

channelId

channel id

tsstring
tracks ?

initial tracks

tsTracksByName
Returns
tsPromise<Status>

leave

tsleave () : Promise<Status> ;

leave call channel

emits user:left event

Returns
tsPromise<Status>

modUsers

tsmodUsers (users: User[]) : Promise<Status> ;

moderate users in call,

disabling send permissions will mute a user's tracks but they will still be able to receive media, disabling recv permissions will pause sending media to user though they will still be connected, updating the permissions will resume send and recv operations.

emits user:mod event

check concepts for more about permissions

Parameters

users

an array of users to moderate

tsUser[]
Returns
tsPromise<Status>

muteTracks

tsmuteTracks (trackName: string | string[], newState: boolean) : Promise<void> ;

Mute user tracks by name(s). this will send empty frames for video and audio

Empty audio frames have every sample's value set to 0. Empty video frames have every pixel set to black.

emits track:mute event

Parameters

trackName

track name to mute

tsstring | string[]
newState

true to mute and false to unmute, if newState is currentState it is ignored

tsboolean
Returns
tsPromise<void>

muteUser

tsmuteUser (userId: string, kind: "audio" | "video", newState: boolean, reason?: string) : Promise<void> ;

mute another user's tracks

the user's tracks are not forwarded to other users in the same call channel until they are unmuted again only call admins can mute and unmute other users or else fails with [UnAuthorized]

this method takes in the track kind rather thanthe trackName to avoid users from recreating new tracks. muting a specific trackName is not supported.

emits track:mute event for all muted tracks

Parameters

userId

the userId to mute

tsstring
kind

kind of track to mute can be either "video" or "audio"

ts"audio" | "video"
newState

true to mute and false to unmute, if newState is currentState it is ignored

tsboolean
reason ?

optional mute reason

tsstring
Returns
tsPromise<void>

on

tson < K extends keyof CallEventMap > (event: K, handler:  (ev: CallEventMap[K]) => any ) : void ;

listen for call events

Parameters

event

event

tsK
handler

event handler

ts (ev: CallEventMap[K]) : any ;
Returns
tsvoid

removeTracks

tsremoveTracks (name: string | string[]) : Promise<void> ;

remove user tracks by name emits track:del event

Parameters

name

track name(s) to remove

tsstring | string[]
Returns
tsPromise<void>