Skip to content
This repository has been archived by the owner. It is now read-only.

sendbird/quickstart-calls-javascript

master
Switch branches/tags
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
css
 
 
img
 
 
js
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

This vanilla JS version of quickstart is OUTDATED. Please check out the react version of quickstart instaed.

Sendbird Calls for JavaScript Quickstart

Platform Languages

Introduction

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.

More about Sendbird Calls for Javascript

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.


Before getting started

This section shows you the prerequisites you need for testing Sendbird Calls for Javascript sample app.

Requirements

The minimum requirements for Calls SDK for Javascript sample are:

  • Node
  • npm (or yarn)
  • Modern browser, supporting WebRTC APIs.

Getting started

If you would like to try the sample app specifically fit to your usage, you can do so by following the steps below.

Create a Sendbird application

  1. Login or Sign-up for an account on Sendbird Dashboard.
  2. Create or select an application on the dashboard.
  3. Note your Sendbird application ID for future reference.
  4. Contact sales to get the Calls menu enabled on your dashboard. A self-serve will be available soon to help you purchase call credits automatically from your dashboard.

Create test users

  1. On the Sendbird dashboard, navigate to the Users menu.
  2. Create at least two new users: one as a caller, and the other as a callee.
  3. Note the user_id of each user for future reference.

Install and run the sample app

  1. Clone this repository
$ git clone git@github.com:sendbird/quickstart-calls-javascript.git
  1. Install dependencies
$ cd quickstart-calls-javascript
$ npm install
  1. In 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';
  1. Build
$ npm run build
  1. Start the sample app
# Start with webpack-dev-sever
$ npm run start:dev

# Start with express server
$ npm run start
  1. If two devices are available, repeat these steps to install the sample app on each device.

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.

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).

// 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

Reference

For further detail on Sendbird Calls for JavaScript, refer to Sendbird Calls SDK for JavaScript README.