Skip to main content

Manage video call overview

This section covers all APIs related to managing video calls such as accepting, rejecting, and ending video calls.

Approve video call API

// aliceVideoCall.approve(address?);
await aliceVideoCall.approve(recipientAddress);

// Approving makes the stream emits CONSTANTS.VIDEO.EVENT.APPROVE event
// which can be used to handle UI, for example, to start the video call.

Approve video call parameters

PropertyTypeDescription
addressstringaddress of the caller received from the stream event in the Push Stream.

Note: Parameters in this style are mandatory.

Details
200 OK

Reject video call API

// aliceVideoCall.deny(address?);
await aliceVideoCall.deny();

// Denying makes the stream emits CONSTANTS.VIDEO.EVENT.DENY event on the call initiator's end
// which can be used to handle UI, for example, to show a toast message to the user.

Reject video call parameters

PropertyTypeDescription
addressstringaddress of the caller received from the stream event in the Push Stream.

Note: Parameters in this style are mandatory.

Details
200 OK

Disconnect video call API

// aliceVideoCall.disconnect();
await aliceVideoCall.disconnect();

// Disconnecting makes the stream emits CONSTANTS.VIDEO.EVENT.DISCONNECT event on the other end
// which can be used to handle UI, for example, to show a toast message to the user.
Details
200 OK

Toggle local video / audio API

aliceVideoCall.config({
video?: Boolean,
audio?: Boolean
})

Toggle local video / audio parameters

PropertyTypeDescription
videoBooleantrue to enable video and false to disable video
audioBooleantrue to enable audio and false to disable audio
Details
200 OK

Getting status of local / remote video / audio

  • The current local video status can be accessed by data.local.video similarly for audio -> data.local.audio.
  • Likewise for remote video and audio, you can access the status by data.incoming[0].video and data.incoming[0].audio.

Handling video call events / UI

Every action that is performed on the video call will emit an event in the Push Stream. You can use these events to update the UI or show some toast messages to the user.

stream.on(CONSTANTS.STREAM.VIDEO, async (data: TYPES.VIDEO.EVENT) => {
if (data.event === CONSTANTS.VIDEO.EVENT.REQUEST) {
// RequestVideo Event is fired when there is an incoming video call request
// store the incoming peer address which will be used to accept/reject the call
// it is recommended to store the incoming caller address in a state that is received
// let incomingCallerAddress = data.peerInfo.address;
}
// other events
});

Peer info object oberview

The peerInfo object is received in the stream for various events. You can use this for various funcationalities, for example: to display the caller's name or profile picture in the UI.

{
"peerInfo":{
"address":"0x...", // Address of the caller (initiator)
"signal":"...", // Signal data required to establish a video call
"meta":{
"rules":{
"access":{
"type": "PUSH_CHAT",
"data":{
"chatId": "...", // ChatId between the caller and the callee
}
}
}
}
}
}