The Conference object in the API handles, sends and updates all the important information throughout the lifetime of the call.
Name | Description |
---|---|
constructor(callId: string, extraData: string) |
Initializes the Conference object with provided data |
getPermissionState(): {DevicePermissionStatus} |
Returns the current permission state for device (audio/video) access |
setOutputDevice(deviceId: string) |
Sets the output device (speaker) for the current session |
startCall() |
Initializes the session, connects to other Peers |
endCall() |
Ends the call, cleaning up any session information |
constructor(callId: string, extraData: string)
Create's the conference object with the custom callId and stores any extraUserData to send as a string (i.e. userId) to other Peers
let status = conf.getPermissionState()
// returns
{
state: "success" | "failed" | "denied",
error: {
reason: string // specific to each Browser DOM
rawStr: string // error to display to user
}
}
getPermissionState() -> DevicePermissionStatus
Between handles all the hard parts of getting device permissions for your application. Returns a
DevicePermissionStatus
object with details about the permission status.
let status = conf.getPermissionState()
// returns
{
state: "success" | "failed" | "denied",
error: {
reason: string // specific to each Browser DOM
rawStr: string // error to display to user
}
}
endCall()
Ends the call, cleaning up any session information and emitting a 'sessionTerminated' event on the Conference() class.
conf.endCall()
setOutputDevice(deviceId: string)
Sets the device to use for audio output in the conference.
conf.setOutputDevice(deviceId: string)
startCall()
Start initializing connection to servers. Joins the call with callId and the extraData set in the constructor. It also sets device permissions, sets up listeners for device data.
conf.startCall()
'devicesUpdated' -> {MediaDeviceInfo[]}
Media devices are automatically pushed to you whenever there's a change. Between supports video/audio input device on all browsers, audio output device are only supported on Chromium browsers.
conf.on('devicesUpdated', (MediaDeviceInfo[]) => { })
'localParticipant' -> {LocalParticipant}
When the local stream of the current user is published, the LocalParticipant
object is
emitted. This object allows for getting the video stream, muting/unmuting devices, changing devices,
etc... Learn more
here
conf.on('LocalParticipant', (LocalParticipant) => { })
'peerJoined' -> {Peer}
When a user joins a call, the Peer
object is emitted. This object allows for getting
their video stream, setting volume data, etc... Learn more
here
conf.on('PeerJoined', (Peer) => { })
'peerLeft' -> {string}
When a user leaves a call, the id of the particpant is emitted as a string
. You can do any
custom cleanup required by your application such as removing the video.
conf.on('PeerLeft', (string) => { })
'socketFailed' -> {}
Emitted when the socket connection fails, the API will attempt to reconnect until it cannot, the
socketDisconnected
is then emitted
conf.on('socketFailed', () => { })
'socketDisconnected' -> {}
Emitted when the socket disconnects unexpectedly.
conf.on('socketDisconnected', () => { })
'socketClose' -> {}
Emitted when the socket is closed from user input.
conf.on('socketClose', () => { })