You can install the Web SDK via NPM:
npm i voximplant-websdk --save #or yarn add voximplant-websdk
Most modern web browsers limit voice and video capture only to web pages loaded over HTTPS. This also means that such a page can't be loaded from a local .html file. For development purposes, local files can be self-hosted. Web browsers allow loading self-hosted pages from localhost over HTTP.
Getting started with VoxImplant.Client singleton
After the SDK is initialized, the connect function should be called to establish a data connection between a browser and the Voximplant Cloud in order to accept and initiate calls. Thus, a developer should add the following event listeners to handle connection events:
The last thing that should be done before the call object can be used is authorization: the Application User's username and password should be passed to the login method. The VoxImplant.Events.AuthResult event is triggered to notify about the login result. For better security, our SDK also provides two additional login methods: with one-time login keys and with renewable tokens.
Using VoxImplant.Config to specify SDK settings during the initialization
There is a number of settings that can be specified while the SDK initialization, let's review them all one-by-one:
- micRequired - if set to true, SDK will show microphone access dialog right after the initialization of the SDK. The VoxImplant.Events.MicAccessResult event will be triggered after the user allowed or denied access to the microphone
- videoSupport - can be used to enable video calls support,
- progressToneCountry - Country code in ISO format for progress tone generated automatically if progressTone set to true. Has "US" value by default,
- progressTone - Automatically plays progress tone by means of SDK according to specified progressToneCountry if set to true.
Please note that SDK currently supports only US and Russian progress tones generated automatically. We will add other countries soon. Meanwhile, you can use browser-based audio playback capabilities for that purpose.
The following example shows how the settings can be passed to the init function: