SDK Update: Twilio Programmable Video

By Karthik BR on October 2, 2017
read

Today we are glad to announce an integration with Twilio Video, which was announced earlier this summer. The Twilio Video JS interface can be found on our ever growing Integrations library.

In addition to Twilio Video, there’s also the pre-existing callstats.io integration to Twilio Voice

Special thanks to Dan Jenkins and the Nimble Ape team for getting this integration up and running!

How to use (examples)

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

Are you a Twilio Voice and Video user? Sign up to callstats.io to better understand your Twilio app’s performance!


Tags: WebRTC, callstats.io, WebRTC Monitoring