...
A DOM element ID must be reserved as display area where the video streaming will be render.
Each Video room is identified by using the CTLive Chat ID.
Code Block | ||
---|---|---|
| ||
// Generate new Token LIVECHATSDK.LIVECHAT.getVideoToken(AD_VIDEO_Obj.chat_id, "AGENT").then( function (data) { var TokenID = data.token; console.log("[VIDYO] Token [" + TokenID + "]" ); // Create a Video Connector VC.CreateVidyoConnector( { viewId: "divPanelVideo", // DOM element reserved to video render viewStyle: "VIDYO_CONNECTORVIEWSTYLE_Default", remoteParticipants: 2, // Max number of participants logFileFilter: "info", // Log levels logFileName: "", userData: "" } ).then( function(vidyoConnector) { // Connect to Video Room vidyoConnector.Connect( { host: "prod.vidyo.io", token: TokenID, //Generated Token displayName: "CUSTOMER", resourceId: "CHAT_DEFAULT_e9f75bfb-b8cc-4141-8c74-646d45636a14", // Video Conference Name, use the CTLive CHAT ID onSuccess: function () { console.log("[VIDYO] CONNECTED"); vidyoConnector.RegisterParticipantEventListener( { onJoined: VIDYO_onJoined, onLeft: VIDYO_onLeft, onDynamicChanged: VIDYO_onDynamicChanged, onLoudestChanged: VIDYO_onLoudestChanged } ); }, onFailure: function (reason) { console.log("[VIDYO] CONNECT ERROR [" + reason + "]"); }, onDisconnected: function (reason) { console.log("[VIDYO] DISCONNECTED [" + reason + "]"); console.log("[VIDYO] Call Disconnect() API on Video Connector"); vidyoConnector.Disconnect().then( function (result) { console.log("[VIDYO] Call Disable() API on Video Connector"); vidyoConnector.Disable(); } ); } } ).catch( function (err) {console.err(err); } ); } ); } ).catch( function(err) { console.err(err); } ); |
Participants events
Use the RegisterParticipantEventListener API to get notified about participant events.
Name | Type | Description |
---|---|---|
onJoined | function | Callback that is triggered when another participant joins a conference. |
onLeft | function | Callback that is triggered when an existing participant leaves a conference. |
onDynamicChanged | function | Callback that is triggered when the order of participants has changed, based on their importance according to active speech detection. |
onLoudestChanged | function | Callback that is triggered when a new participant becomes the loudest, based on active speech detection. |
Documentation
Vidyo Developer Center: https://developer.vidyo.io/#/documentation
Vidyo API reference guide: https://developer.vidyo.io/#/reference-guide