const loggerLevel = {
NONE: 'NONE', // Not used for writing log outputs.
ERROR: 'ERROR', // Logs that represent the failure of the Calls SDK execution.
WARNING: 'WARNING', // Logs that indicate potentially problematic situations.
INFO: 'INFO', // Logs that track the general events of the Calls SDK.
};
Returns APP ID
Returns current user
Returns SDK version.
Add call sound for specific SoundType.
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, theaddDirectCallSound()
method should be called after a user’s event such as clicking a button. For Safari, you have to call theaddDirectCallSound()
method in the event listener of a user’s event such asonclick()
.
document.querySelector('#yourButton').addEventListener('click', function() {
SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.DIALING, RESOURCE_URL);
});
Add a device-specific SendBirdCallListener
event handler.
Once the event handler is added, responding to device events such as incoming
calls can be managed as shown below:
// The UNIQUE_HANDLER_ID below is a unique user-defined ID for a specific event handler.
SendBirdCall.addListener(UNIQUE_HANDLER_ID, {
onRinging: (call) => {
...
}
});
Add a recording listener.
In order to use the interfaces and methods provided in a SendBirdCall
instance,
a user must be connected to SendBird server by authentication. Without authentication,
calling the methods of the Calls SDK will not work.
Authenticate method must be called after initialization
Create WebSocket connection to SendBird server. A user can receive a dial and many other peer signals via WebSocket connection.
A user’s call history can be retrieved using the next() method of a DirectCallLogListQuery instance which returns a list of call objects.
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 to fetch more call logs.
}
});
Creates a new room for group calls.
Create a room list query.
Deauthenticate SendBirdCall
instance. A User can no longer use the interfaces and
methods provided in a SendBirdCall
instance.
WebSocket connection will also be disconnected during the call.
Delete all custom items associated with the call
You can delete a specific custom item with its given key.
const customItemKeysToDelete = ['key1', 'key2'];
SendBirdCall.deleteCustomItems('call-id', customItemKeysToDelete)
.then(result => {
// Handle deleted custom items using a returned promise.
}, error => {
// Handle error
});
Initiate a call by providing the callee’s user id into the SendBirdCall.dial() method. Use the CallOption object to choose initial call configuration, such as audio or video capabilities, video settings, and mute settings.
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) {
// Dialing failed
}
// Dialing succeeded
});
Fetch a room by its ID.
Returns a set of available audio input devices.
Returns a set of available audio input devices.
Returns a set of available video devices.
Gets a cached room by its ID.
Returns a call
Returns the current audio input device.
Returns the current audio output device.
Returns the current video input device.
Returns the number of ongoing calls
Returns the call objects of ongoing calls
Pass Webhook data to sendbird-calls
SDK.
Returns true if DirectCallSound is playing.
Register the user's push token.
Unregister all SendBirdCall
listeners.
Unregister all recording listener.
Remove call sound for specific SoundType.
Unregister a SendBirdCall
listener.
Unregister a recording listener.
Selects the audio input device.
Select the audio output device.
Selects the video input device.
Set timeout value of call connection
You can specify log level to display log output to the console.
Set timeout value of ringing
Unregister the user's all push tokens.
Unregister the user's push token.
Custom items can be added to a call either by a caller or a callee. When dialing, the caller can add a Dictionary of String and String to a DialParams object by using the customItems property. The default value of a call's custom items is an empty Dictionary.
const customItemsToAdd = { key1: 'value1', key2: 'value2' };
SendBirdCall.updateCustomItems('call-id', customItemsToAdd)
.then(result => {
// Handle added custom items using a returned promise.
}, error => {
// Handle error
});
Manually updates media devices.
Note: In Chrome or Firefox, the SendBirdCall.updateMediaDevices() doesn’t 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 need to be called after a media device has been changed. In such cases, calling the SendBirdCall.updateMediaDevices() manually may be required.
The Calls SDK requires access permissions to microphone and camera to communicate with Sendbird server. This method will retrieve a list of available media devices or any actual media streams.
Note: When a user makes or receives a call for the first time by your JavaScript application running in a browser, the browser might prompt the user to grant microphone and camera access permissions.
Generated using TypeDoc