Calls
calls
index
methods
Properties
channel
the current call channel
stringstatus
current call status
"connected" | "connecting" | "disconnected" | "checking"Methods
addTracks
addTracks (tracks: TracksByName) : Promise<void> ;add local tracks to call
emits track:add event
Parameters
Returns
Promise<void>addUsers
addUsers (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
string[]Returns
Promise<Status>configure
configure (config: CallConfig) : Promise<Status> ;update channel configuration
emtts cnl:config event
Parameters
Returns
Promise<Status>create
create (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
stringReturns
Promise<Status>delUsers
delUsers (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
string[]Returns
Promise<Status>delete
delete (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
stringReturns
Promise<Status>getUsers
getUsers () : Promise<ActiveUser[]> ;get active call users,
Returns
active users mapped with their active tracks and muted statuses
Promise<ActiveUser[]>join
join (channelId: string, tracks?: TracksByName) : Promise<Status> ;join an existing call
emits user:join event
Parameters
channelId
channel id
stringReturns
Promise<Status>modUsers
modUsers (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
Returns
Promise<Status>muteTracks
muteTracks (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
string | string[]newState
true to mute and false to unmute, if newState is currentState it is ignored
booleanReturns
Promise<void>muteUser
muteUser (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
stringkind
kind of track to mute can be either "video" or "audio"
"audio" | "video"newState
true to mute and false to unmute, if newState is currentState it is ignored
booleanreason ?
optional mute reason
stringReturns
Promise<void>on
on < K extends keyof CallEventMap > (event: K, handler: (ev: CallEventMap[K]) => any ) : void ;listen for call events
Parameters
Returns
voidremoveTracks
removeTracks (name: string | string[]) : Promise<void> ;remove user tracks by name
emits track:del event
Parameters
name
track name(s) to remove
string | string[]Returns
Promise<void>