Vonage Video APIs

The Vonage's Video APIs built atop OpenTok platform, is a WebRTC platform that embeds interactive video, voice, messaging, and screen sharing into web and mobile apps. The OpenTok platform includes client libraries for web and native clients (iOS, Android), server-side SDKs and a REST API. 

The OpenTok.js integration to callstats.io was built by WebRTC.ventures and maintained by the callstats team. The code documentation is available on GitHub.

Integration steps

Serve the callstats-opentok-shim from your website or from callstats.io’s CDN, add https://api.callstats.io/callstats-opentok-shim.min.js file on your page after the callstats.js script. Please make sure to add them ahead of tokbox js


<script src="https://api.callstats.io/static/callstats.min.js"></script>
<script src="https://api.callstats.io/static/callstats-opentok-shim.js"></script>
<script src="https://static.opentok.com/v2/js/opentok.min.js"></script>

Then, initialize like shown below:

CallstatsOpenTok.initialize(opts);

Currently, the shim supportsAppID, AppSecret, SessionID, RemoteID,InitCallback,StatsCallback, andconfigParams. So, for example:

CallstatsOpenTok.initialize({
  AppId: 834738451,
  AppSecret: 'sOTjsJEfwPUGW4SRJI4BhbprGJ3lfO6Kp+:ixCX1P9mzNThlsW+YNLlb=',
  SessionId: '1_eiTh54cMjNx4FNk-JkT15IXNTGtNnh8W03m0RwYTMxUMNMDyhU2gzMxezMXjaF0Mj0E-UH4'
});

Documentation forInitCallback,StatsCallback, andconfigParamscan be found in the API documentation - https://docs.callstats.io/javascript/#callbacks-and-error-handling and https://docs.callstats.io/javascript/#callstats-initialize-with-app-secret.

API For sending the media events:

CallstatsOpenTok.sendFabricEvent(
CallstatsOpenTok.fabricEvents.audioMute
);

Supported fabricEvents:

const fabricEvents = {
    audioMute: 'audioMute',
   audioUnmute: 'audioUnmute',
   videoPause: 'videoPause',
   videoResume: 'videoResume',
   screenShareStart: 'screenShareStart',
   screenShareStop: 'screenShareStop',
   dominantSpeaker: 'dominantSpeaker',
 }

API For sending the User Feedback:

let feedback = {
'overall': 2, // scale 1-5
'comment': 'user comments',
}
CallstatsOpenTok.sendUserFeedback(
feedback
);