Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
The Stringee communication platform makes it easy to embed high-quality interactive video, voice, SMS into webs and mobile apps.
A library to build high-quality voice, video applications in the Cloud. With this library, you can:
Install SDK from NPM
Create StringeeClient
Setup voice call
Set up video call
npm install stringee
import { StringeeUtil, StringeeClient, StringeeCall, StringeeCall2 } from "stringee";
const client = new StringeeClient();
client.on("connect", () => {
// connected to StringeeServer
});
client.on("authen", (response) => {
// on authen user, response object
// {
// r : 0
// requestId : 1
// clients : [{…}]
// connectionId : 123456789
// ping_after_ms : 45000
// projectId : 1234
// userId : "abc"
// ice_servers : [{…}, {…}, {…}, {…}]
// message : "SUCCESS"
// }
// response success: r = 0
// response error: r != 0 and message : "Error message"
});
client.on("disconnect", () => {
//disconnected
});
client.on("incomingcall", (incomingcall) => {
// Setup voice call
});
client.on("incomingcall2", (call2) => {
// Setup video call
});
client.on("requestnewtoken", () => {
// request new token;
// please get new access_token from YourServer
// and call client.connect(new_access_token)
});
client.on("otherdeviceauthen", (data) => {
console.log("otherdeviceauthen: ", data);
});
stringeeClient.connect(accessToken);
<!-- Create video tag -->
<video id="remoteVideo" playsinline autoplay style="width: 350px"></video>
var call = new StringeeCall(stringeeClient, from, to);
// SETTING CALL EVENTS
call.on("error", (info) => {
// on error
});
call.on("addlocalstream", (stream) => {
// on add local stream
});
call.on("addremotestream", (stream) => {
// on add remote stream
});
call.on("signalingstate", (state) => {
// signalingstate
if (state.code == 6) {// call ended
incomingCallDiv.style.display = "none";
callStopped();
}
if (state.code == 5) {// busy here
callStopped();
}
const reason = state.reason;
callStatus.innerHTML = reason;
});
call.on("mediastate", (state) => {
// mediastate
});
call.on("info", (info) => {
// on info
});
call.on("otherdevice", (data) => {
// "on otherdevice
});
// MAKE CALL
call.makeCall((response) => {
// response json data success
// {
// r : 0,
// callId : "call-vn-1-D2BIJCH2U9-1686467352064",
// fromNumber : "FROM_NUMBER",
// customDataFromYourServer : "",
// toType : "internal",
// requestId : 9,
// video : false,
// message : "SUCCESS",
// toNumber : "TO_NUMBER",
// peerToPeerCall : true
// }
});
// AFTER THEN
call.hangup((res) => {
// hangup res
// and remove source remote video
remoteVideo.srcObject = null;
});
client.on("incomingcall", (incomingcall) => {
// Object incomingcall is StringeeCall
// reassign incomingcall to call
call = incomingcall;
// you can call SETTING CALL EVENTS
});
// Answare the call
call.answer((res) => {
// answer res
});
// OR Reject the call
call.reject((response) => {
// reject res
});
var call = new StringeeCall2(stringeeClient, FROM_NUMBER, TO_NUMBER, true);
// SETTING CALL EVENT
call.on("addlocaltrack", (localtrack) => {
// add local track
});
call.on("addremotetrack", (track) => {
// add remote track
});
call.on("removeremotetrack", (track) => {
// remove remote track
track.detachAndRemove();
});
call.on("removelocaltrack", (track) => {
track.detachAndRemove();
});
call.on("signalingstate", (state) => {
// signalingstate object
// {
// code : 6
// reason : "Ended"
// sipCode : SIP_CODE
// sipReason : SIP_REASON
// }
});
call.on("mediastate", (state) => {
// mediastate
});
call.on("otherdevice", (msg) => {
// otherdevice
});
call.on("info", (info) => {
// receiving info
});
// MAKE CALL
call.makeCall((response) => {
// response object
// {
// r : 0
// requestId : 2
// callId : "call-vn-1-D2BIJCH2U9-1686467455592"
// message : "SUCCESS"
// }
});
// HANGUP
call.hangup((res) => {});
// at the same time we remove all video tracks
call.subscribedTracks.forEach((track) => {
track.detachAndRemove();
});
// MUTE
call.mute(true);
// SEND INFO
call.sendInfo({ a: "hello", b: 1 }, (res) => {});
// ENABLE/DISABLE VIDEO
// disable Local Video
call.enableLocalVideo(false);
// enable Local Video
call.enableLocalVideo(true);
// SWITCH CAMERA (mobile only)
call.switchCamera();
// Transfer
// TYPE is string and value in list ['agent', 'queue']
// TYPE_VALUE is string and value in list ['blind', 'attended', 'conference', 'coach']
call.transferCall(to, TYPE, TYPE_VALUE, console.log);
// HOLD VIDEO CALL
call.sendHold(null, (h) => {});
call.sendUnHold((h) => {});
// LEAVE ROOM
call.leaveRoom();
client.on("incomingcall2", (call2) => {
// Object incomingcall is StringeeCall2
// reassign call2 to call
call = call2;
// then you should call SETTING CALL EVENTS
});
FAQs
The Stringee communication platform makes it easy to embed high-quality interactive video, voice, SMS into webs and mobile apps.
We found that stringee demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.