Twilio Programmable Video is a cloud communications platform enabling one-on-one and multi-party voice, chat and video to be embedded into web, desktop, and mobile software.
See also our Twilio Voice integration.
In HTML:
<!DOCTYPE html>
<html>
<head>
<!-- Load callstats.io library (it provides window.callstats -->
<script src="https://api.callstats.io/static/callstats.min.js"></script>
<!-- Load Twilio Video JS library -->
<script src="//media.twiliocdn.com/sdk/js/video/v1/twilio-video.min.js"></script>
<!-- Load callstats-twilio-video library (it provides window.callstatstwiliovideo) -->
<script src="https://api.callstats.io/static/callstats-twilio-video.min.js"></script>
<!-- Load our app code -->
<script src="js/app.js"></script>
</head>
<body>
<!-- your stuff -->
</body>
</html>
In app.js:
const Video = Twilio.Video;
Video.connect('$TOKEN', { name: 'room-name' }).then(room => {
callstats = callstatstwiliovideo(room, peerToPeer, AppID, AppSecretOrTokenGenerator, localUserID, csInitCallback, csStatsCallback, configParams);
console.log('Connected to Room "%s"', room.name);
// you can also set the room name later if you don't have the room info while initializing callstats
callstatstwiliovideo.setTwilioVideoRoom(room);
...
});
// Run the callstats-twilio-video library for this Twilio.Video.Room
Npm and bower packages for callstats-twilio-video is also available. Read here the full documentation
Sample app can be found here - https://github.com/nimbleape/video-quickstart-js