Sendbird Calls for JavaScript sample, guiding you to bulid a real-time voice and video calls quickly and easily.
Sendbird Calls SDK for JavaScript is used to initialize, configure, and build voice and video calling functionality into your JavaScript client app. In this repository, you will find the steps you need to take before implementing the Calls SDK into a project, and a sample app which contains the code for implementing voice and video call.
Find out more about Sendbird Calls for JavaScript on Calls for JavaScript doc. If you need any help in resolving any issues or have questions, visit our community.
This section shows you the prerequisites you need for testing Sendbird Calls for Javascript sample app.
The minimum requirements for Calls SDK for Javascript sample are:
If you would like to try the sample app specifically fit to your usage, you can do so by following the steps below.
caller
, and the other as a callee
.user_id
of each user for future reference.
$ git clone git@github.com:sendbird/quickstart-calls-javascript.git
$ cd quickstart-calls-javascript
$ npm install
envs.js
, replace the value of TEST_APP_ID
with APP_ID
which you can find on your Sendbird application information. If you skip this step, an additional field for the Application ID will appear in the login view.
export const TEST_APP_ID = 'SAMPLE_APP_ID';
shell script
$ npm run build
$ npm run start
6. If two devices are available, repeat these steps to install the sample app on each device.
<br />
## Making your first call
### How to make a call
1. On each device, open a browser and go to the index page of the sample web app. The default URL is `localhost:9000`.
2. On each browser, choose an app type between **Full-screen** or **Widget**.
3. On the primary device’s browser, log in to the sample app with the user ID set as the `caller`.
4. On the secondary device’s browser, log in to the sample app with the user ID set as the `caller`.
5. On the primary browser, specify the user ID of the `callee` and initiate a call.
6. If all steps are followed correctly, an incoming call notification will appear on the browser of the `callee`.
7. Reverse the roles. Initiate a call from the other browser.
8. If the two testing devices are near each other, use headphones to make a call to prevent audio feedback.
<br />
## Sound Effects
You can use different sound effects to enhance the user experience for events that take place while using Sendbird Calls.
To add sound effects, use the `SendBirdCall.addDirectCallSound(type: SoundType, uri: string)` method for the following events: dialing, ringing, reconnecting, and reconnected. Remember to set sound effects before the mentioned events occur. To remove sound effects, use the `SendBirdCall.Options.removeDirectCallSound(type: SoundType)` method.
Use `SendBirdCall.addDirectCallSound(type: SoundType, uri: string)` method to set sound effects for a number of types: dialing, ringing, reconnecting, reconnected. Sound effects must be set before the events occur. To unregister a sound effect, remove it by calling `SendBirdCall.Options.removeDirectCallSound(type: SoundType)`.
```javascript
// Play on a caller’s side when making a call.
SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.DIALING, DIALING_SOUND_URL);
// Play on a callee’s side when receiving a call.
SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.RINGING, RINGING_SOUND_URL);
// Play when a connection is lost, but the SDK immediately attempts to reconnect.
SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.RECONNECTING, RECONNECTING_SOUND_URL);
// Play when the connection is re-established.
SendBirdCall.addDirectCallSound(SendBirdCall.SoundType.RECONNECTED, RECONNECTED_SOUND_URL);
For more information about sound effects, see the SDK for JavaScript README for Sound effects
For further detail on Sendbird Calls for JavaScript, refer to Sendbird Calls SDK for JavaScript README.