Detalhes do pacote

sendbird-calls

sendbird5.7kSEE LICENSE IN LICENSE.md1.10.20

SendBird Calls JavaScript SDK

sendbird, sendbird.com, voice, video

readme (leia-me)

Sendbird Calls SDK for JavaScript

minified size minzipped size npm version Commercial License

Table of contents

  1. Introduction
  2. Before getting started
  3. Getting started
  4. Making your first call
  5. Implementation guide
  6. Appendix


Introduction

Sendbird Calls is the latest addition to our product portfolio. It enables real-time calls between users within a Sendbird application. SDKs are provided for iOS, Android, and JavaScript. Using any one of these, developers can quickly integrate voice and video call functions into their own client apps, allowing users to make and receive web-based real-time voice and video calls on the Sendbird platform.

If you need any help in resolving any issues or have questions, please visit our community.

How it works

Sendbird Calls SDK for JavaScript provides a framework to make and receive voice and video calls. Direct calls in the SDK refers to one-to-one calls. To make a direct voice or video call, the caller specifies the user ID of the intended callee, and dials. Upon dialing, all of the callee’s authenticated devices will receive notifications for an incoming call. The callee then can choose to accept the call from any one of the devices. When the call is accepted, a connection is established between the devices of the caller and the callee. This marks the start of a direct call. Call participants can mute themselves, or call with either or both of the audio and video by using output devices such as speaker and microphone for audio, and front, rear camera for video. A call may be ended by either party. The Sendbird Dashboard displays call logs in the Calls menu for dashboard owners and admins to review.

More about Sendbird Calls SDK for JavaScript

Find out more about Sendbird Calls for JavaScript on Calls SDK for JavaScript doc.


Before getting started

This section shows the prerequisites you need to check to use Sendbird Calls SDK for JavaScript.

Requirements

The minimum requirements for Calls SDK for JavaScript are:

// browser console
(window.RTCPeerConnection) ? console.log('supported') : console.log('not supported')


Getting started

This section gives you information you need to get started with Sendbird Calls SDK for JavaScript.

Install and configure the SDK

  1. Download and install the SDK using npm or yarn. ```bash

    npm

    npm install sendbird-calls

yarn

yarn add sendbird-calls


2. Import `SendBirdCall` as an es6 module
```javascript
import SendBirdCall from "sendbird-calls";

SendBirdCall.init(APP_ID)

Note: If you are using TypeScript, you have to set '--esModuleInterop' setting to true for 'default import', or use import * as SendBirdCall from "sendbird-calls" instead.

Or use the minified file to initialize SendBirdCall as global variable in the header

<script type="text/javascript" src="SendBirdCall.min.js"></script>
<script type="text/javascript">
    SendBirdCall.init(APP_ID)
</script>

Grant media device permissions

When a user makes or receives a call for the first time on a given website, the browser will prompt the user to grant microphone and camera access permissions. This might also occur when the SendBirdCall.useMedia() function is first called. Without these permissions, users will be unable to retrieve a list of available media devices or to retrieve any actual media streams.


Making your first call

Follow the step-by-step instructions below to authenticate and make your first call.

Step 1: Initialize the SendBirdCall instance in a client app

As shown below, the SendBirdCall instance must be initiated when a client app is launched. Initialize the SendBirdCall instance with the APP_ID of the Sendbird application you would like to use to make a call.

SendBirdCall.init(APP_ID);

Step 2: Authenticate a user and connect websocket to server

In order to make and receive calls, users must first be authenticated on the SendBird server using the SendBirdCall.authenticate() function. The SendBirdCall object must then be connected to the websocket server using the SendBirdCall.connectWebSocket() method.

// Authentication
const authOption = { userId: USER_ID, accessToken: ACCESS_TOKEN };

SendBirdCall.authenticate(authOption, (res, error) => {
    if (error) {
        // auth failed
    } else {
        // auth succeeded
    }
});

// Websocket Connection
SendBirdCall.connectWebSocket()
  .then(/* connect succeeded */)
  .catch(/* connect failed */);

Step 3: Add an event handler

There are two types of event handlers the SDK provides for a client app to respond to various events: a device-specific listener and a call-specific listener.

- Device-specific listener

Register a device-specific event handler using the SendBirdCall.addListener() method. It is recommended to add the event handler during initialization because it is a prerequisite for detecting an onRinging() event. The code below shows the way device-wide events such as incoming calls are handled once device-specific event is added.

SendBirdCall.addListener(UNIQUE_HANDLER_ID, {
    onRinging: (call) => {
        ...
    },
    onAudioInputDeviceChanged: (currentDevice, availableDevices) => {
        ...
    },
    onAudioOutputDeviceChanged: (currentDevice, availableDevices) => {
        ...
    },
    onVideoInputDeviceChanged: (currentDevice, availableDevices) => {
        ...
    }
});

UNIQUE_HANDLER_ID is any unique string value such as UUID.

Event listener Invocation criteria
onRinging Incoming calls are received on the callee’s device.
onAudioInputDeviceChanged Audio input devices have changed.
onAudioOutputDeviceChanged Audio output devices have changed.
onVideoInputDeviceChanged Video input devices have changed.

- Call-specific listener

Register a call-specific event handler by attaching an event handler function directly to the properties of the call object. Responding to call-specific events such as establishing a successful call connection is then handled as shown below.

// call is 'DirectCall' object
call.onEstablished = (call) => {
    ..,
};

call.onConnected = (call) => {
    ...
};

call.onEnded = (call) => {
    ...
};

call.onReconnecting = (call) => {
    ...
};

call.onReconnected = (call) => {
    ...
};

call.onRemoteAudioSettingsChanged = (call) => {
    ...
};

call.onRemoteVideoSettingsChanged = (call) => {
    ...
};

call.onCustomItemsUpdated = (call, updatedKeys) => {
    ...
};

call.onCustomItemsDeleted = (call, deletedKeys) => {
    ...
};

call.onRemoteRecordingStatusChanged = (call) => {
    ...
};
Event listener Invocation criteria
onEstablished The callee accepted the call using the method call.accept(). However, neither the caller or callee’s devices are connected to media devices yet.
onConnected A connection is established between the caller and callee’s media devices such as microphones and speakers. The voice or video call can begin.
onEnded The call has ended on either the caller or the callee’s devices. When the call.end() method is used from either party, a call ends. The call.end() event listener is also invoked if the call is ended for other reasons. Refer to Call results in Appendix for all possible reasons for call termination.
onRemoteAudioSettingsChanged The other party changed their audio settings.
onRemoteVideoSettingsChanged The other party changed their video settings.
onCustomItemsUpdated One or more of call’s custom items that are used to store additional information have been updated.
onCustomItemsDeleted One or more of call’s custom items that are used to store additional information have been deleted.
onReconnecting call started attempting to reconnect to the other party after a media connection disruption.
onReconnected The disrupted media connection reconnected.
onRemoteRecordingStatusChanged The other user’s recording status has been changed.

Step 4: Make a call

First, prepare the dialParams call parameter object to initiate a call. This contains the intended callee’s user id and a callOption object. The callOption is used to set the call’s initial configuration, such as mute or unmute. Once prepared, the dialParams object is then passed into the SendBirdCall.dial() method to start making a call.

const dialParams = {
    userId: CALLEE_ID,
    isVideoCall: true,
    callOption: {
        localMediaView: document.getElementById('local_video_element_id'),
        remoteMediaView: document.getElementById('remote_video_element_id'),
        audioEnabled: true,
        videoEnabled: true
    }
};

const call = SendBirdCall.dial(dialParams, (call, error) => {
    if (error) {
        // dial failed
    }

    // dial succeeded
});

call.onEstablished = (call) => {
    ...
};

call.onConnected = (call) => {
    ...
};

call.onEnded = (call) => {
    ...
};

call.onRemoteAudioSettingsChanged = (call) => {
    ...
};

call.onRemoteVideoSettingsChanged = (call) => {
    ...
};

A media viewer is a HTMLMediaElement such as <audio> and <video> tags to display media stream. The remoteMediaView is required for the remote media stream to be displayed. It is recommended to set autoplay property of the media viewer to true.

The media viewers can also be set using the call.setLocalMediaView(element) or call.setRemoteMediaView(element).

<video id="remote_video_element_id" autoplay>
// Set media viewer lazily
call.setLocalMediaView(document.getElementById('local_video_element_id'));
call.setRemoteMediaView(document.getElementById('remote_video_element_id'));

Step 5: Receive a call

Register a listener first to receive incoming calls. Accept or decline incoming calls by using the call.accept() or the call.end() methods. If the call is accepted, a media session will automatically be established.

Before accepting any calls, event listeners such as onEstablished, onConnected must be registered. Once registered, these listeners enable reacting to in-call events through callbacks methods.

SendBirdCall.addListener(UNIQUE_HANDLER_ID, {
    onRinging: (call) => {
        call.onEstablished = (call) => {
            ...
        };

        call.onConnected = (call) => {
            ...
        };

        call.onEnded = (call) => {
            ...
        };

        call.onRemoteAudioSettingsChanged = (call) => {
            ...
        };

        call.onRemoteVideoSettingsChanged = (call) => {
            ...
        };

        const acceptParams = {
            callOption: {
                localMediaView: document.getElementById('local_video_element_id'),
                remoteMediaView: document.getElementById('remote_video_element_id'),
                audioEnabled: true,
                videoEnabled: true
            }
        };

        call.accept(acceptParams);
    }
});

Note: If the media viewer elements have been set through the call.setLocalMediaView() and call.setRemoteMediaView(), ensure that the same media viewers are set in acceptParams’s callOption. Otherwise, these will be overridden during the call.accept().

Incoming calls are received through the application's persistent internal server connection, which is established by SendBirdCall.connectWebSocket(). In the event of accidental disconnection, the application will attempt to reconnect every 2 seconds.


Implementation guide

Register event handlers

There are two types of event handlers the SDK provides for a client app to respond to various events: a device-specific listener and a call-specific listener.

- Device-specific listener

Register a device-specific event handler using the SendBirdCall.addListener() method. It is recommended to add the event handler during initialization because it is a prerequisite for detecting an onRinging() event. The code below shows the way device-wide events such as incoming calls are handled once device-specific event is added.

SendBirdCall.addListener(UNIQUE_HANDLER_ID, {
    onRinging: (call) => {
        ...
    },
    onAudioInputDeviceChanged: (currentDevice, availableDevices) => {
        ...
    },
    onAudioOutputDeviceChanged: (currentDevice, availableDevices) => {
        ...
    },
    onVideoInputDeviceChanged: (currentDevice, availableDevices) => {
        ...
    }
});

UNIQUE_HANDLER_ID is any unique string value such as UUID.

Event listener Invocation criteria
onRinging Incoming calls are received on the callee’s device.
onAudioInputDeviceChanged Audio input devices have changed.
onAudioOutputDeviceChanged Audio output devices have changed.
onVideoInputDeviceChanged Video input devices have changed.

- Call-specific listener

Register a call-specific event handler by attaching an event handler function directly to the properties of the call object. Responding to call-specific events such as establishing a successful call connection is then handled as shown below.

// call is 'DirectCall' object
call.onEstablished = (call) => {
    ..,
};

call.onConnected = (call) => {
    ...
};

call.onEnded = (call) => {
    ...
};

call.onReconnecting = (call) => {
    ...
};

call.onReconnected = (call) => {
    ...
};

call.onRemoteAudioSettingsChanged = (call) => {
    ...
};

call.onRemoteVideoSettingsChanged = (call) => {
    ...
};

call.onCustomItemsUpdated = (call, updatedKeys) => {
    ...
};

call.onCustomItemsDeleted = (call, deletedKeys) => {
    ...
};

call.onRemoteRecordingStatusChanged = (call) => {
    ...
};
Event listener Invocation criteria
onEstablished The callee accepted the call using the method call.accept(). However, neither the caller or callee’s devices are connected to media devices yet.
onConnected A connection is established between the caller and callee’s media devices such as microphones and speakers. The voice or video call can begin.
onEnded The call has ended on either the caller or the callee’s devices. When the call.end() method is used from either party, a call ends. The call.end() event listener is also invoked if the call is ended for other reasons. Refer to [Calls result] in Appendix for all possible reasons for call termination.
onRemoteAudioSettingsChanged The other party changed their audio settings.
onRemoteVideoSettingsChanged The other party changed their video settings.
onCustomItemsUpdated One or more of call’s custom items that are used to store additional information have been updated.
onCustomItemsDeleted One or more of call’s custom items that are used to store additional information have been deleted.
onReconnecting call started attempting to reconnect to the other party after a media connection disruption.
onReconnected The disrupted media connection reconnected.
onRemoteRecordingStatusChanged The other user’s recording status has been changed.

Make a call

First, prepare the dialParams call parameter object to initiate a call. This contains the intended callee’s user id and a callOption object. The callOption is used to set the call’s initial configuration, such as mute or unmute. Once prepared, the dialParams object is then passed into the SendBirdCall.dial() method to start making a call.

const dialParams = {
    userId: CALLEE_ID,
    isVideoCall: true,
    callOption: {
        localMediaView: document.getElementById('local_video_element_id'),
        remoteMediaView: document.getElementById('remote_video_element_id'),
        audioEnabled: true,
        videoEnabled: true
    }
};

const call = SendBirdCall.dial(dialParams, (call, error) => {
    if (error) {
        // dial failed
    }

    // dial succeeded
});

call.onEstablished = (call) => {
    ...
};

call.onConnected = (call) => {
    ...
};

call.onEnded = (call) => {
    ...
};

call.onRemoteAudioSettingsChanged = (call) => {
    ...
};

call.onRemoteVideoSettingsChanged = (call) => {
    ...
};

A media viewer is a HTMLMediaElement such as <audio> and <video> tags to display media stream. The remoteMediaView is required for the remote media stream to be displayed. It is recommended to set autoplay property of the media viewer to true.

The media viewers can also be set using the call.setLocalMediaView(element) or call.setRemoteMediaView(element).

<video id="remote_video_element_id" autoplay>
// Set media viewer lazily
call.setLocalMediaView(document.getElementById('local_video_element_id'));
call.setRemoteMediaView(document.getElementById('remote_video_element_id'));

Receive a call

Register a listener first to receive incoming calls. Accept or decline incoming calls by using the call.accept() or the call.end() methods. If the call is accepted, a media session will automatically be established.

Before accepting any calls, event listeners such as onEstablished, onConnected must be registered. Once registered, these listeners enable reacting to in-call events through callbacks methods.

SendBirdCall.addListener(UNIQUE_HANDLER_ID, {
    onRinging: (call) => {
        call.onEstablished = (call) => {
            ...
        };

        call.onConnected = (call) => {
            ...
        };

        call.onEnded = (call) => {
            ...
        };

        call.onRemoteAudioSettingsChanged = (call) => {
            ...
        };

        call.onRemoteVideoSettingsChanged = (call) => {
            ...
        };

        const acceptParams = {
            callOption: {
                localMediaView: document.getElementById('local_video_element_id'),
                remoteMediaView: document.getElementById('remote_video_element_id'),
                audioEnabled: true,
                videoEnabled: true
            }
        };

        call.accept(acceptParams);
    }
});

Note: If the media viewer elements have been set through the call.setLocalMediaView() and call.setRemoteMediaView(), ensure that the same media viewers are set in acceptParams’s callOption. Otherwise, these will be overridden during the call.accept().

Incoming calls are received through the application's persistent internal server connection, which is established by SendBirdCall.connectWebSocket(). In the event of accidental disconnection, the application will attempt to reconnect every 2 seconds.

Handle a current call

During an ongoing call, a caller may mute or unmute their microphone using the call.muteMicrophone() or call.unmuteMicrophone() methods. If the callee changes their audio setting, the caller is notified through the call.onRemoteAudioSettingsChanged() listener. The caller may start or stop video using the call.startVideo() or call.stopVideo() methods. If the callee changes their video setting, the caller is notified through the call.onRemoteVideoSettingsChanged() listener.

// Mute my microphone
call.muteMicrophone();

// Unmute my microphone
call.unmuteMicrophone();

// Start to show video
call.startVideo();

// Stops showing video
call.stopVideo();

// Receives the audio event
call.onRemoteAudioSettingsChanged = (call) => {
    if (call.isRemoteAudioEnabled) {
        // The peer has been unmuted.
        // Consider displaying a muted icon.
    } else {
        // The peer has been muted.
        // Consider displaying an unmuted icon.
    }
};

// Receives the video event
call.onRemoteVideoSettingsChanged = (call) => {
    if (call.isRemoteVideoEnabled) {
        // The peer has started the video.
    } else {
        // The peer has stopped the video.
    }
};

End a call

A caller may end a call using the call.end() method. This event can be processed through the call.onEnded listener. This listener is also triggered when the callee ends the call.

// End a call
call.end();

// Receives the event
call.onEnded = (call) => {
    // Consider releasing or destroying call-related view from here.
};

Mirror a MediaView

You can set the current user’s local video view as mirrored or reversed when the camera is facing the user. This can be easily done by adding the transform CSS property to your localMediaView element.

#local-media-view
{
    transform: rotateY(180deg); /* add this property */
}

Configuring media devices

The SendBirdCall object contains a collection of methods used to configure media devices. Each media type has corresponding methods to a. retrieve a list of devices, b. retrieve the current device, c. select a device, and d. update devices. If media device configuration changes, any ongoing calls are affected immediately.

Method Description
useMedia(constraints) Attempts to grant permission to access media devices
getCurrentAudioInputDevice() Get the current audio input device
getAvailableAudioInputDevices() Get a list of available audio input devices
selectAudioInputDevice(mediaDeviceInfo) Select the audio input device to use
getCurrentAudioOutputDevice() Get the current audio output device
getAvailableAudioOutputDevices() Get a list of available audio output devices
selectAudioOutputDevice(mediaDeviceInfo) Select the audio output device to use
getCurrentVideoInputDevice() Get the current video input device
getAvailableVideoInputDevices() Get a list of available video input devices
selectVideoInputDevice(mediaDeviceInfo) Select the video input device to use
updateMediaDevices(constraints) Manually update media devices

The device specific-event handler also contains a collection of event listeners used to handle changes in media devices.

Event listener Invocation criteria
onAudioInputDeviceChanged Audio input devices have changed
onAudioOutputDeviceChanged Audio output devices have changed
onVideoInputDeviceChanged Video input devices have changed

Before using the methods and event listeners listed above, ensure that SendBirdCall.useMedia(constraints) has been executed. Failing to do this will result in these methods causing unexpected behaviors or failed outcomes.

// on settings view opened
const mediaAccess = SendBirdCall.useMedia({audio: true, video: true});

// This code demonstrates for audio input devices. The same can also be done for audio output and video input devices.
const availableDevices = SendBirdCall.getAvilableAudioInputDevices();
const currentDevice = SendBirdCall.getCurrentAudioInputDevice();
// Populate option elements in select element
populateSelectOption(availableDevices);
// Select option which matches current device
selectOption(currentDevice);

SendBirdCall.addListener('my-listener', {
    onAudioInputDeviceChanged: (currentDevice, availableDevices) => {
        // Populate option elements in select element
        populateSelectOption(availableDevices);
        // Select option which matches current device
        selectOption(currentDevice);
    }
});

...

SendBirdCall.removeListener('my-listener');

//on settings view closed
mediaAccess.dispose();

Always be sure to dispose() of the mediaAccess retrieved from SendBirdCall.useMedia. Failure to do so will result in vulnerable media access permissions that could grant unintended use of the user’s camera microphone or camera.

In Chrome/Firefox, SendBirdCall.updateMediaDevices does not need to be called if the media device event listener is used to update the view or device list. However, in Safari, those event listeners might not be called after a media device change. In such cases, manually calling the SendBirdCall.updateMediaDevices may be required.

Deauthenticate a user

When users log out of their call client apps, they must be deauthenticated with SendBirdCall.deauthenticate() method. This will discard all current instances of directCall, all session keys, and all user information. However, the device-specific event handler will remain.

// Deauthenticate
SendBirdCall.deauthenticate();

Retrieve a call information

The local or remote user’s information is available through the directCall.localUser and directCall.remoteUser properties.

Retrieve call history

Sendbird Calls server automatically stores details of calls, which can be used later to display a call history for users. A user’s call history is available through a DirectCallLogListQuery instance.

/*
interface DirectCallLogListQueryParams {
    myRole: string,
    endResults: string[],
    limit: number
}
*/
const params = {
    myRole: 'dc_caller',
    endResults: ['DECLINED', 'COMPLETED'],
    limit: 100
};
const query = SendBirdCall.createDirectCallLogListQuery(params);

query.next((directCallLog) => {
    if (query.hasNext && !query.isLoading) {
        // The query.next() can be called once more.
        // If a user wants to fetch more call logs.
  }
});
Method & Property Description
next() Used to query call history from SendBirdCall server.
hasNext If true, there is more call history to be retrieved.
isLoading If true, call history is being retrieved from Sendbird Calls server.
params.limit Specifies the number of call logs to return at once.
params.myRole Returns call logs of the specified role. For example, if myRole is dc_callee, the query will return only the callee’s call logs.
params.endResults Returns the call logs for specified results. If more than one result is specified, they are processed as OR condition and all call logs corresponding with the specified end results will be returned. For example, if the endResults is set as NO_ANSWER or CANCELED, only the NO_ANSWER and CANCELED call logs will be returned.

Sound effect

- Sound types

Type Description
DIALING Refers to a sound that is played on a caller’s side when the caller makes a call to a callee.
RINGING Refers to a sound that is played on a callee’s side when receiving a call.
RECONNECTING Refers to a sound that is played when a connection is lost, but immediately tries to reconnect. Users are also allowed to customize the ringtone.
RECONNECTED Refers to a sound that is played when a connection is re-established.

- Add sound

Method Description
addDirectCallSound() Adds a specific sound such as a ringtone and an alert tone with URL to a direct call.
Parameter Type Description
type SoundType Specifies the sound type to be used according to the event.
url string Specifies the URL of the sound file. You can use the URI of the asset on the server or ObjectURL created by URL.createObjectURL().

Note: In modern web browsers, they have their own autoplay policies and can block the addDirectCallSound() method from being directly executed. To solve this problem for Chrome and Firefox, the addDirectCallSound() method should be called after a user’s event such as clicking a button. For Safari, you have to call the addDirectCallSound() method in the event listener of a user’s event such as onclick().

document.querySelector('#yourButton').addEventListener('click', function() {
    SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.DIALING, RESOURCE_URL);
});

- Remove sound

Method Description
removeDirectCallSound(type: SoundType) Removes a specific sound from a direct call.
Parameter Type Description
type SoundType Specifies the type of sound to be used according to the event.


Appendix

Call relay protocol

Sendbird Calls is based on WebRTC to enable real-time calls between users with P2P connections, but sometimes connectivity issues may occur for users due to network policies that won’t allow WebRTC communications through Firewalls and NATs (Network Address Translators). For this, Sendbird Calls uses two different types of protocols, Session Traversal Utilities for NAT (STUN) and Traversal Using Relays around NAT (TURN). STUN and TURN are protocols that support establishing a connection between users.

> Note: See our GitHub page to learn about the requirements and how to use the Calls SDKs behind a firewall.

How STUN and TURN works

Session Traversal Utilities for NAT (STUN) is a protocol that helps hosts to discover the presence of a NAT and the IP address, which eventually makes the connection between two endpoints. Traversal Using Relays around NAT (TURN) is a protocol that serves as a relay extension for data between two parties.

Sendbird Calls first try to make a P2P connection directly using the Calls SDK. If a user is behind a NAT/Firewall, Calls will discover the host's public IP address as a location to establish connection using STUN. In most cases, STUN server is only used during the connection setup and once the session has been established, media will flow directly between two users. If the NAT/Firewall still won't allow the two users to connect directly, TURN server will be used to make a connection to relay the media data between two users. Most of the WebRTC traffic is connected with STUN.

Call results

Information relating the end result of a call can be obtained at any time through the directCall.endResult property, best accessed within the onEnded() callback.

EndResult Description
NO_ANSWER The callee failed to either accept or decline the call within a specific amount of time.
CANCELED The caller canceled the call before the callee could accept or decline.
DECLINED The callee declined the call.
COMPLETED The call ended after either party ended it
TIMED_OUT Sendbird Calls server failed to establish a media session between the caller and callee within a specific amount of time.
CONNECTION_LOST The data stream from either the caller or the callee has stopped due to a WebRTC connection issue.
DIAL_FAILED The dial() method call has failed.
ACCEPT_FAILED The accept() method call has failed.
OTHER_DEVICE_ACCEPTED The incoming call was accepted on a different device. This device received an incoming call notification, but the call ended when a different device accepted it.

Encoding configurations

Category Value Note
Frames per Second 24 fps
Maximum Resolution 720p 1280x720 px; standard HD
Audio Codec OPUS
Video Codec VP8

changelog (log de mudanças)

Change Log

1.10.20 (Nov 5, 2024 UTC)

  • Fixed the bug that local stream become disabled when a user hold other direct call.
  • Added start_ts and end_ts to the DirectCallLogListQueryParams.

1.10.19 (Mar 21, 2024 UTC)

  • Fixed the crash of the previous version

1.10.18 (Mar 14, 2024 UTC)

  • Updated the WebRTC version
  • Improved WebRTC internal logging

1.10.17 (Feb 21, 2024 UTC)

  • Added webhook property in DialParams.

1.10.16 (Dec 15, 2023 UTC)

  • Added DirectCallEndResult.NOT_CONNECTED. When a direct call is ended before connecting, the call will have an end result of DirectCallEndResult.NOT_CONNECTED.

1.10.15 (Sep 15, 2023 UTC)

  • Fixed a bug in the local recording that the output file contains a black screen in the bad network sometimes.
  • Fixed a bug in the local recording that the previous larger frame lasts when the resolution has been lowered in the bad network.

1.10.14 (Aug 17, 2023 UTC)

  • Fixed an issue where call will not be properly reconnected after network connection has been lost.

1.10.13 (Aug 4, 2023 UTC)

  • Fixed an issue where CSP(Content Security Policy) error occurs if script-src is self.

1.10.12 (Aug 2, 2023 UTC)

  • Fix an issue where Direct Call's Connection Quality would report UNAVAILABLE for a few seconds after connecting the call.

1.10.11 (Jul 31, 2023 UTC)

  • Added support for Direct Call quality monitoring in Sendbird Dashboard.

1.10.10 (Jun 16, 2023 UTC)

  • Added DirectCall.onCalleeDialReceived event listener to notify the caller when the callee has received the call. This listener will be called when the callee has received the SendBirdCallListener.onRinging event.

1.10.9 (May 10, 2023 UTC)

  • Fixed the type error in the declaration file.

1.10.8 (May 9, 2023 UTC)

  • Added the missing export of RoomState enum.
  • Fixed the type error in the declaration file.
  • Changed the return type of RoomListQuery.next(), RoomListQuery.prev() to the actual Room instance, rather than the data object.

1.10.7 (Apr 21, 2023 UTC)

  • Improved connection quality listener in DirectCall.

1.10.6 (Apr 12, 2023 UTC)

  • Added a feature to detect connection qualities in ongoing DirectCall.
    • Added ConnectionQualityState.
    • Added ConnectionQualityMonitoringMode.
    • Added ConnectionMetrics.
    • Added setConnectionQualityListener(mode: ConnectionQualityMonitoringMode, listener: (metrics: ConnectionMetrics) => void): void, removeConnectionQualityListener(): void in DirectCall;

1.10.5 (Apr 4, 2023 UTC)

  • Fixed the bug that User.metaData is always undefined.
  • Fixed self is not defined error in node environment.

1.10.4 (Mar 10, 2023 UTC)

  • Added a feature to kick other participants in a room with the same user id as the current user.
    • Added kickSiblings in EnterParams.

1.10.3 (Mar 2, 2023 UTC)

  • Fixed an error in SendbirdCall.connectWebSocket().
  • Removed the unexpected console logs.

1.10.2 (Feb 14, 2023 UTC)

  • Added room event listeners to detect local user’s connection with the server.
    • Added localParticipantDisconnected, localParticipantReconnected in RoomEventMap.
  • Improved the reconnection logic for short-term disconnection in Room.

1.10.1 (Feb 3, 2023 UTC)

  • Fixed the bug that the client with only one of audio/video permission can't use the allowed device in video call/room.
    • Now, the client can use the microphone in video call/room regardless of camera permission.
    • Likewise, the client can use the camera in video call/room regardless of microphone permission.
  • Improved stability.

1.10.0 (Jan 31, 2023 UTC)

  • Added a feature to invite users to enter a room.
    • Added Room.sendInvitation(invitee: string): Promise<RoomInvitation>.
    • Added RoomInvitation class to manage invitation.
    • Added RoomInvitation.accept(): Promise<void>, RoomInvitation.decline(): Promise<void>, RoomInvitation.cancel(): Promise<void>.
    • Added invitationAccepted, invitationDeclined, invitationCanceled in RoomEventMap.
  • Added a new interface to delete a room.
    • Added Room.delete().

1.9.3 (April 11, 2022 UTC)

  • Bug fix
    • Fixed the unexpected error when joining the room that the user exited before.

1.9.2 (April 8, 2022 UTC)

  • Bug fix
    • Fixed the bug that group call breaks in chrome v100.

1.9.1 (February 17, 2022 UTC)

  • Bug fix
    • Fixed the bug that selectAudioOutputDevice(mediaDeviceInfo: MediaDeviceInfo): void doens't work in group call.

1.9.0 (December 9, 2021 UTC)

For 1.9.0, a feature to delete a room in Group call is released.

  • Added deleted in RoomEventMap which is invoked when the room has been deleted by the Platform API.

1.8.2 (November 19, 2021 UTC)

  • Bug fix
    • Fixed the unexpected error when joining room in which there are more than two participants.

1.8.1 (November 1, 2021 UTC)

  • Bug fix
    • Fixed the bug that the permission dosen't be revoked after Room.exit().
  • Added missing type declarations.

1.8.0 (October 27, 2021 UTC)

For 1.8.0, a new feature is released for both Group call and Direct call features respectively.

For the Group call feature, you can now add and manage custom items to store additional information for a room.

  • Added custom items feature in Group Call
    • Added customItems in Room.
    • Added customItems in RoomParams.
    • Added updateCustomItems(customItems: CustomItems): Promise<CustomItemsResult> and deleteCustomItems(customItemKeys: string[]): Promise<CustomItemsResult> in Room.
    • Added customItemsUpdated and customItemsDeleted in RoomEventMap.

For the Direct call feature, you can now hold and resume calls which allows you to accept an incoming call or switch between calls.

  • Added hold and resume feature in Direct Call
    • Added hold(): Promise<void> and unhold(force: boolean): Promise<void> in DirectCall.
    • Added isOnHold in DirectCall.
    • Added holdActiveCall in DialParams and AcceptParams.
    • Added onUserHoldStatusChanged in DirectCall.
  • Added getOngoingCalls() in SendBirdCall to retrieve a list of ongoing Direct Calls in the Calls SDK.
  • Added missing return type of push token registration APIs.
  • Improved stability.

1.7.2 (October 8, 2021 UTC)

  • Added push token registration APIs
    • Below methods are added in SendBirdCall
      • registerPushToken(pushToken: string, tokenType: TokenType): Promise<void>
      • unregisterPushToken(pushToken: string, tokenType: TokenType): Promise<void>
      • unregisterAllPushTokens(tokenType: TokenType): Promise<void>
    • Below enum is added in SendBirdCall
      • TokenType

1.7.1 (July 21, 2021 UTC)

  • Bug fix
    • Fixed the bug that audioEnabled and videoEnabled in DirectCallOption doesn't work.

1.7.0 (June 4, 2021 UTC)

  • Added capability to query rooms.
    • Below interfaces are added in SendBirdCall
      • RoomListQuery
      • RoomListQueryParams
    • Below methods are added in SendBirdCall
      • createRoomListQuery(params: RoomListQueryParams): RoomListQuery
  • Added support for customized host URL
    • Now, you can customize API/WebSocket host URL when init().
    • Below method is changed in SendBirdCall
      • init(appId: string, apiHost?: string, websocketHost?: string): void
  • Improved security.
  • Improved stability.

1.6.1 (May 21, 2021 UTC)

  • Bug fix
    • Fixed the error and undefined behavior in recording feature.
      • Now, DirectCall.startRecording() produces .webm file in Chrome and Firefox, .mp4 file in Safari.
    • Fixed the noise when calling addDirectCallSound().
    • Fixed the bug that sometimes the error message of authenticate() is blank.

1.6.0 (April 22, 2021 UTC)

  • Added support for group call.
    • Below class is added in SendBirdCall
      • Room
    • Below methods are added in SendBirdCall
      • createRoom(params: RoomParams): Promise<Room>
      • getCachedRoomById(roomId: string): Room
      • fetchRoomById(roomId: string): Promise<Room>
    • Below interfaces are added in SendBirdCall
      • RoomParams
      • EnterParams
      • Participant
      • LocalParticipant
      • RemoteParticipant
    • Below enums are added in SendBirdCall
      • RoomType
      • ParticipantState
  • Bug fix
    • Fixed an unexpected exception.
  • Improved stability.

1.5.4 (Mar 12, 2021 UTC)

  • Added suuport for screen share in DirectCall.
    • Below methods are added in DirectCall:
      • startScreenShare(): Promise<void>
      • stopScreenShare(): void
    • Below property is added in DirectCall:
      • readonly isLocalScreenShareEnabled: boolean

1.6.0-beta (Feb 17, 2021 UTC)

Sendbird Calls SDK version 1.6.0 supports the early access program for group calling. New concepts introduced in this version center around rooms and participants.

  • Added group call feature.
    • Below methods are added in SendBirdCall
      • createRoom(): Promise<Room>
      • getCachedRoomById(roomId: string): Room
      • fetchRoomById(roomId: string): Promise<Room>
    • Below class is added in SendBirdCall
      • Room
    • Below interfaces are added in SendBirdCall
      • EnterParams
      • Participant
      • LocalParticipant
      • RemoteParticipant
    • Below enum is added in SendBirdCall
      • ParticipantState

1.5.3 (Jan 26, 2021 UTC)

  • Bug fix
    • Fixed doubling bug in recording.

1.5.2 (Jan 14, 2021 UTC)

  • Bug fix
    • Fixed an unexpected exception.

1.5.1 (Dec 28, 2020 UTC)

  • Bug fix
    • Fixed an unexpected exception.

1.5.0 (Dec 24, 2020 UTC)

  • Added support for integration with Sendbird Chat
    • Added sendBirdChatOptions to DialParams
  • Added support for Call summary on the dashboard.
  • Improved backend scalability
  • Enhanced security for compliance

1.4.1 (Nov 3, 2020 UTC)

  • Improved stability

1.4.0 (Nov 3, 2020 UTC)

  • Added remote recording progress event.
    • Below properties are added in DirectCall:
      • onRemoteRecordingStatusChanged: ((call: DirectCall) => void) | null
      • localRecordingStatus: RecordingStatus
      • remoteRecordingStatus: RecordingStatus
    • Below enum is added in SendBirdCall:
      • RecordingStatus
  • Improved stability

1.3.0 (September 23, 2020)

  • Added snapshot feature
    • Below methods are added in DirectCall
      • captureLocalVideoView(callback?: CaptureVideoViewHandler): Promise<CaptureVideoViewResult>
      • captureRemoteVideoView(callback?: CaptureVideoViewHandler): Promise<CaptureVideoViewResult>
  • Added recording feature
    • Below methods are added in SendBirdCall
      • addRecordingListener(id: string, listener: SendBirdCallRecordingListener): void
      • removeRecordingListener(id: string): void
      • removeAllRecordingListeners(): void
    • Below methods are added in DirectCall
      • startRecording(options: DirectCallRecordOption): string
      • stopRecording(recordingId: string): boolean
    • Below constructor is added in SendBirdCall
      • DirectCallRecordOption
  • Added sound effect feature
    • Below property is added in SendBirdCall
      • SoundType
    • Below methods are added in SendBirdCall
      • addDirectCallSound(type: SoundType, url: string): Promise<boolean>
      • removeDirectCallSound(type: SoundType): boolean
  • Improved validation of customItems interfaces. Only string keys/values are available for customItems or customItemsKeys arguments of,
    • updateCustomItems(callId: string, customItems: CustomItems, callback?: CustomItemsHandler): Promise<CustomItemsResult> in SendBirdCall
    • deleteCustomItems(callId: string, customItemKeys: string[], callback?: CustomItemsHandler): Promise<CustomItemsResult> in SendBirdCall
    • updateCustomItems(customItems: CustomItems, callback?: CustomItemsHandler): Promise<CustomItemsResult> in DirectCall
    • deleteCustomItems(customItemsKeys: string[], callback?: CustomItemsHandler): Promise<CustomItemsResult> in DirectCall

1.2.5 (September 2, 2020)

  • Enhanced prerequisite check in init().
  • Improved stability.

    1.2.4 (August 19, 2020)

  • Bug fix
    • Fixed the connection problem with Android SDK.

      1.2.3 (August 13, 2020)

  • Bug fix
    • Fixed the unexpected exceptions.
  • Improved stability

    1.2.2 (July 28, 2020)

  • Replaced MediaDeviceInfo with InputDeviceInfo in following SendBirdCall methods
    • getCurrentAudioInputDevice(): InputDeviceInfo
    • getAvailableAudioInputDevices(): InputDeviceInfo[]
    • selectAudioInputDevice(mediaDeviceInfo: InputDeviceInfo): void
    • getCurrentVideoInputDevice(): InputDeviceInfo
    • getAvailableVideoInputDevices(): InputDeviceInfo[]
    • selectVideoInputDevice(mediaDeviceInfo: InputDeviceInfo): void
  • Added missing type information
    • SendbirdCall's useMedia() method can return undefined
    • DirectCall's setLocalMediaView(mediaView: HTMLMediaElement)
    • DirectCall's setRemoteMediaView(mediaView: HTMLMediaElement)
  • Added webhook support
    • Add handleWebhookData(data: WebhookData): void to SendBirdCall
    • Add WebhookData interface

1.2.1 (July 21, 2020)

  • Buf fix
    • Fixed the unexpected exceptions in safari.

      1.2.0 (July 20, 2020)

  • Added support for Peer-to-peer call.
    • The Peer-to-peer option can be configured on the dashboard.
  • Added getting ongoing call count and ongoing status of DirectCall.
    • Added getOngoingCallCount(): number to SendBirdCall.
    • Added readonly isOngoing: boolean to DirectCall.
  • Added setCallConnectionTimeout(timeout: number): void to SendBirdCall.
    • The call connection timer starts when the callee accepts the call. The timer will end the call after the specified timeout interval.
  • Improved stability.

    1.1.4 (July 14, 2020)

  • Bug fix
    • Fixed typo in d.ts.
    • Fixed import error in Node environment.

      1.1.3 (June 18, 2020)

  • Improved stability.

    1.1.2 (June 16, 2020)

  • Improved stability.

    1.1.1 (May 25, 2020)

  • Bug fix
    • Fixed the bug that some console logging ignored LoggerLevel.

      1.1.0 (May 22, 2020)

  • Below property is added in SendBirdCall
    • ErrorCode
  • Below keys are added in SendBirdCall.LoggerLevel
    • WARNING
    • INFO
  • Below property is added in DirectCall
    • readonly callLog
  • Below property is added in DirectCallLog
    • readonly isFromServer

      1.0.2 (May 1, 2020)

  • Below methods are added in SendBirdCall
    • setRingingTimeout(timeout: int): void
  • Optimized video call frame rate.
  • Improved stability.

    1.0.1 (Mar 25, 2020)

  • Bug fix
    • Fixed the bug that onRemoteVideoSettingsChanged doesn't fire.
  • The default value of callOption.videoEnabled is changed to ture.

    1.0.0 (Mar 24, 2020)

  • README has been updated. Refer to readme to learn how to configure media devices.
  • Interfaces for media devices are added / changed.

    • Below methods are added in SendBirdCall
      • getCurrentVideoInputDevice(): MediaDeviceInfo
      • getAvailableVideoInputDevices(): MediaDeviceInfo[]
      • selectVideoInputDevice(mediaDeviceInfo: MediaDeviceInfo): void
      • updateMediaDevices(constraints: { audio: boolean; video: boolean }): void
      • useMedia(constraints: { audio: boolean; video: boolean }): MediaAccess
    • Below event listener is added in SendBirdCallListener
      • onVideoInputDeviceChanged: ((currentVideoInputDevice: MediaDeviceInfo, availableVideoInputDevices: MediaDeviceInfo[]) => void) | null
    • Below methods are changed in SendBirdCall
      • getCurrentVideoInputDevice(): MediaDeviceInfo
      • getAvailableAudioInputDevices() is now synchronous
      • selectAudioInputDevice(mediaDeviceInfo: MediaDeviceInfo) is now synchronous
      • getAvailableAudioOutputDevices() is now synchronous
      • selectAudioOutputDevice(mediaDeviceInfo: MediaDeviceInfo) is now synchronous
  • Deprecated methods are removed

    • In SendBirdCall,
      • dial(userId: string, isVideoCall: boolean, callOption: DirectCallOption, callback?: DialHandler): DirectCall is removed. Use dial(params: DialParams, callback?: DialHandler): DirectCall instead.
    • In DirectCall,
      • onRemoteAudioEnabled event listener is removed. Use onRemoteAudioSettingsChanged instead.
      • accept(callOption: DirectCallOption) is removed. Use accept(params: AcceptParams): void instead.
      • mute() is removed. Use muteMicrophone() instead.
      • unmute() is removed. Use unmuteMicrophone() instead.
    • In DirectCallOption
      • localVideoView is removed. Use localMediaView instead.
      • remoteVideoView is removed. Use remoteMediaView instead.

0.9.0 (Mar 18, 2020)

  • Internal improvement

    0.8.1 (Mar 13, 2020)

  • Bug fix
    • Fixed error when user accepted call without specifying localMediaView
  • Below properties are added in DirectCall
    • readonly callId: string
    • readonly isEnded: boolean

0.8.0 (Mar 9, 2020)

  • Interface for video call has been implemented

    • Below properties are added in DirectCall

      • readonly isLocalVideoEnabled: boolean
      • readonly isRemoteVideoEnabled: boolean
      • readonly localMediaView: HTMLMediaElement
      • readonly remoteMediaView: HTMLMediaElement
    • Below methods are added in DirectCall

      • setLocalMediaView(): Promise<void>
      • setRemoteMediaView(): Promise<void>
      • stopVideo(): void
      • startVideo(): void
    • Below implementable event listeners are added in DirectCall

      • onRemoteVideoSettingsChanged: ((call: DirectCall) => void) | null
    • Below property is added in DirectCallOption

      • videoEnabled?: boolean
  • Wrong type definitions have been fixed

    • Type definitions for below methods in class SendBirdCall has been fixed.
      • getAvailableAudioInputDevices(): MediaDeviceInfo[] -> getAvailableAudioInputDevices(): Promise<MediaDeviceInfo[]>
      • selectAudioInputDevice(mediaDeviceInfo: MediaDeviceInfo): void -> selectAudioInputDevice(mediaDeviceInfo: MediaDeviceInfo): Promise<void>
      • getAvailableAudioOutputDevices(): MediaDeviceInfo[] -> getAvailableAudioOutputDevices(): Promise<MediaDeviceInfo[]>
      • selectAudioOutputDevice(mediaDeviceInfo: MediaDeviceInfo): void -> selectAudioOutputDevice(mediaDeviceInfo: MediaDeviceInfo): Promise<void>

0.7.0 (Feb 21, 2020)

  • Selecting an audio input / output device is implemented.
    • Below methods are added in SendBirdCall
      • getCurrentAudioInputDevice(): MediaDeviceInfo
      • getAvailableAudioInputDevices(): MediaDeviceInfo[]
      • selectAudioInputDevice(mediaDeviceInfo: MediaDeviceInfo): void
      • getCurrentAudioOutputDevice(): MediaDeviceInfo
      • getAvailableAudioOutputDevices(): MediaDeviceInfo[]
      • selectAudioOutputDevice(mediaDeviceInfo: MediaDeviceInfo): void
    • Below implementable event listeners are added in SendBirdCallListener
      • onAudioInputDeviceChanged: ((currentAudioInputDevice: MediaDeviceInfo, availableAudioInputDevices: MediaDeviceInfo[]) => void) | null
      • onAudioOutputDeviceChanged: ((currentAudioOutputDevice: MediaDeviceInfo, availableAudioOutputDevices: MediaDeviceInfo[]) => void) | null
  • Setting / retrieving custom items is implemented.

    • Below methods are added in SendBirdCall
      • updateCustomItems(callId: string, customItems: CustomItems, callback?: CustomItemsHandler): Promise<CustomItemsResult>
      • deleteCustomItems(callId: string, customItemKeys: string[], callback?: CustomItemsHandler): Promise<CustomItemsResult>
      • deleteAllCustomItems(callId: string, callback?: CustomItemsHandler): Promise<CustomItemsResult>
    • Below property is added in DirectCall
      • readonly customItems: CustomItems
    • Below methods are added in DirectCall
      • updateCustomItems(customItems: CustomItems, callback?: CustomItemsHandler): Promise<CustomItemsResult>
      • deleteCustomItems(customItemsKeys: string[], callback?: CustomItemsHandler): Promise<CustomItemsResult>
      • deleteAllCustomItems(callback?: CustomItemsHandler): Promise<CustomItemsResult>
    • Below implementable event listeners are added in DirectCall
      • onCustomItemsUpdated: ((call: DirectCall, updatedKeys: string[]) => void) | null
      • onCustomItemsDeleted: ((call: DirectCall, deletedKeys: string[]) => void) | null
    • Below property is added in DirectCallLog
      • readonly customItems: CustomItems
  • Reconnection is implemented in DirectCall

    • Below implementable event listeners are added in DirectCall
      • onReconnected: ((call: DirectCall) => void) | null
      • onReconnecting: ((call: DirectCall) => void) | null
  • Signature of the SendBirdCall.dial() has been changed.

    • dial(userId: string, isVideoCall: boolean, callOption: DirectCallOption, callback?: DialHandler): DirectCall is now deprecated
    • dial(params: DialParams, callback?: DialHandler): DirectCall is now recommended.
  • Signature of the DirectCall.accept() has been changed.

    • accept(callOption: DirectCallOption): void is now deprecated
    • accept(params: AcceptParams): void is now recommended.

0.6.10 (Jan 31, 2020)

  • Added Typescript Definition.
  • Polished error description.
  • Properties / Method deprecated. Deprecated interfaces might be removed in future releases.
    • DirectCall.onRemoteAudioEnabled is deprecated. Use onRemoteAudioSettingsChanged Instead.
    • DirectCall.mute is deprecated. Use muteMicrophone Instead.
    • DirectCall.unmute is deprecated. Use unmuteMicrophone Instead.
  • Min / max of the limit field for SendBirdCall.createDirectCallLogListQuery parameter has been adjusted to 10 / 100 each.
  • DirectCall.onRemoteAudioSettingsChanged / onRemoteAudioEnabled is not fired anymore when actual setting is not changed.

0.6.6 (Jan 22, 2020)

  • Call is automatically disconnected after certain time (currently 1 min) when one peer leaves call session without explicitly hanging up.
  • Removed redundant deprecation warning in callOption.

0.6.5 (Jan 8, 2020)

  • Changed some parameters names of callOption.
    • callOption.localVideoView and callOption.remoteVideoView is now deprecated.
    • localVideoView -> localMediaView
    • remoteVideoView -> remoteMediaView

0.6.4 (Jan 2, 2020)

  • Fixed call.getDuration()

0.6.3 (Dec 26, 2019)

  • Fixed connection for FireFox, exported LoggerLevel enum

0.6.2 (Dec 20, 2019)

  • Fixed logger, polyfill

0.6.1 (Dec 20, 2019)

  • Removed core-js dependency