
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
video-call-client
Advanced tools
Javascript client for siosLIFE's Video Call server.
var VideoCallClient = require('video-call-client');
The first thing you need to do is create a client using VideoCallClient
.
var videoCallClient = VideoCallClient(serverUrl, iceConfig, constraints);
The iceConfig
object is a
RTCConfiguration
object used to create the
RTCPeerConnection.
The constraints
is a MediaStreamConstraints
object passed to
getUserMedia.
You can connect to the Video Call server by using the login
method of the video call client.
When the connection is established a connected
event will be emitted to notify that the client is ready to start and receive calls.
videoCallClient.login({ user: ..., families: ... });
videoCallClient.on('connected', function() {
// let's see who's online
console.log(videoCallClient.users);
});
The object passed to login
will be sent to the Video Call server,
so more properties can be sent if needed.
A machine can connect to the server to receive calls even if no users is logged in.
To do this, the machineLogin
method can be used:
videoCallClient.machineLogin({ institutionId: ..., machineId: ... });
videoCallClient.on('connected', function() {
// Will now start receiving calls
});
Like with login
, a connected
event will be emitted when the connection is established and the client is ready to receive calls.
A client logged as a machine user cannot start calls.
A call can be started with VideoCallClient
's .startCall()
method.
This method receives the target user's ID and returns an OutgoingCall
object.
If the target user accepts the call, the OutgoingCall
will emit an accepted
event with a Call
object.
If the call gets rejected, either by the user of if the user is unavailable, a rejected
event will be emitted with the reason why the call was rejected.
var outgoingCall = videoCallClient.startCall(userId, institutionId);
outgoingCall.on('accepted', function(call) {
// your call was accepted
});
outgoingCall.on('rejected', function(reason) {
// too bad, you've been rejected
});
When someone calls you VideoCallClient
will emit a call
event.
This event's callback will receive an IncomingCall
object to .accept()
or .reject()
the call.
The IncomingCall
's .accept()
method will return a Call
object.
videoCallClient.on('call', function(incomingCall) {
// accept the call
var call = incomingCall.accept();
// or reject it
incomingCall.reject();
// but don't forget that the calling user can give up on you
incomingCall.on('end', function() {
// too late
});
});
When a call is established, you can use the Call
object to end the call.
It will also emit an end
event if the other user ends the call on their side.
// lets end this
call.terminate();
// before someone else does
call.on('end', function() {
// bye bye
});
The VideoCallClient
object has a users
property.
This is an array of all the users that are online in the same room.
When a users joins or leaves the room, a user-joined
and a user-left
event will be emitted, respectively.
videoCallClient.users.forEach(function(user) {
console.log(user);
});
videoCallClient.on('user-joined', function(user) {
// new user
});
videoCallClient.on('user-left', function(user) {
// this one left the room
});
A user only has a userId
and a type
.
FAQs
Javascript client for siosLIFE Video Call server.
We found that video-call-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.