voximplant-websdk
v4.8.3-2844
Published
VoxImplant Web SDK for embedding voice and video communication into web applications.
Downloads
9,830
Readme
This SDK works with VoxImplant cloud platform for real-time communication app development. Browser-compatible, won't work on server. The SDK uses WebRTC in WebRTC-enabled browsers (Chrome, Firefox, Opera, etc).
Documentation.
Quickstart.
Platform's HowTo's.
Installation
npm install voximplant-websdk --save
# OR
yarn add voximplant-websdk
unpkg version
<script type="text/javascript" src="https://unpkg.com/voximplant-websdk/voximplant.min.js"></script>
jsDelivr version
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/voximplant-websdk/voximplant.min.js"></script>
Importing:
import * as VoxImplant from 'voximplant-websdk';
First steps
Below you can see two simple client scripts with full initialization of the WebSDK
Create call
import * as VoxImplant from 'voximplant-websdk';
const customerName = 'foo',
appName = 'bar',
userName = 'baz',
password = 'securepass';
const sdk = VoxImplant.getInstance();
sdk.init()
.then(ev=>sdk.connect(false))
.then(ev=>sdk.login(`${customerName}@${appName}.${userName}.voximplant.com`, password))
.then(ev=>{
// Now we ready for your first audio only call
sdk.call({number:'anotherCustomer',video:{sendVideo:false,receiveVideo:false}});
})
Answer for incoming call
import * as VoxImplant from 'voximplant-websdk';
const customerName = 'foo',
appName = 'bar',
userName = 'baz',
password = 'securepass';
const sdk = VoxImplant.getInstance();
sdk.init()
.then(ev=>sdk.connect(false))
.then(ev=>sdk.login(`${customerName}@${appName}.${userName}.voximplant.com`, password))
.then(ev=>{
// Now we ready for processing incoming calls
sdk.on(VoxImplant.Events.IncomingCall,ev=>{
ev.call.answer('',{},{sendVideo:false,receiveVideo:false});
})
})