A library to build high-quality voice, video applications in the Cloud. With this library, you can:
- you can make voice calls or video calls
- proactive call control
- View Sample
Table of Contents
Install SDK from NPM
Create StringeeClient
Setup voice call
Set up video call
Install SDK from NPM
npm install stringee
Create StringeeClient
import { StringeeUtil, StringeeClient, StringeeCall, StringeeCall2 } from "stringee";
const client = new StringeeClient();
client.on("connect", () => {
});
client.on("authen", (response) => {
});
client.on("disconnect", () => {
});
client.on("incomingcall", (incomingcall) => {
});
client.on("incomingcall2", (call2) => {
});
client.on("requestnewtoken", () => {
});
client.on("otherdeviceauthen", (data) => {
console.log("otherdeviceauthen: ", data);
});
stringeeClient.connect(accessToken);
Setup voice call
<video id="remoteVideo" playsinline autoplay style="width: 350px"></video>
Make the voice call
var call = new StringeeCall(stringeeClient, from, to);
call.on("error", (info) => {
});
call.on("addlocalstream", (stream) => {
});
call.on("addremotestream", (stream) => {
});
call.on("signalingstate", (state) => {
if (state.code == 6) {
incomingCallDiv.style.display = "none";
callStopped();
}
if (state.code == 5) {
callStopped();
}
const reason = state.reason;
callStatus.innerHTML = reason;
});
call.on("mediastate", (state) => {
});
call.on("info", (info) => {
});
call.on("otherdevice", (data) => {
});
call.makeCall((response) => {
});
call.hangup((res) => {
remoteVideo.srcObject = null;
});
Receiving the voice call
client.on("incomingcall", (incomingcall) => {
call = incomingcall;
});
call.answer((res) => {
});
call.reject((response) => {
});
Set up video call
Make the video call
var call = new StringeeCall2(stringeeClient, FROM_NUMBER, TO_NUMBER, true);
call.on("addlocaltrack", (localtrack) => {
});
call.on("addremotetrack", (track) => {
});
call.on("removeremotetrack", (track) => {
track.detachAndRemove();
});
call.on("removelocaltrack", (track) => {
track.detachAndRemove();
});
call.on("signalingstate", (state) => {
});
call.on("mediastate", (state) => {
});
call.on("otherdevice", (msg) => {
});
call.on("info", (info) => {
});
call.makeCall((response) => {
});
call.hangup((res) => {});
call.subscribedTracks.forEach((track) => {
track.detachAndRemove();
});
call.mute(true);
call.sendInfo({ a: "hello", b: 1 }, (res) => {});
call.enableLocalVideo(false);
call.enableLocalVideo(true);
call.switchCamera();
call.transferCall(to, TYPE, TYPE_VALUE, console.log);
call.sendHold(null, (h) => {});
call.sendUnHold((h) => {});
call.leaveRoom();
Receiving the video call
client.on("incomingcall2", (call2) => {
call = call2;
});