First of all, Closed Captioning has to be enabled in Portal Features -> flag CcEnabled.
For the VidyoPlatform <<*.platform.vidyo.io>> it has been configured already.
The next step would be to discover the Closed Captioning Service URL that we will be talking to.
CC Service Discovery
You can trigger a GET request at https://getservices.platform.vidyo.io with the corresponding response:
You have to /Start & /Stop the CC service in order to use it AND Subscribe /Unsubscribe from the CC topic to receive the CC callbacks.
Start Service
Call /startClosedCaptioning Web Services API in order to start the CC Service. So, you have to obtain the JWT token first with the VidyoClient JS API since any WebServices REST API requires a JWT token:
which we’re going to use to subscribe to the topic and receive CC updates:
awaitvidyoConnector.SubscribeToTopic({ topicSubscriptionToken: subscriptionToken,messageCallback: (data) => {console.log("CC: Data Received: "+ data); },statusCallback: (status, message, code) => {if (status ==="SUBSCRIPTION_SUBSCRIBED") {this.ccEnabled =true; // a flag to remember$("#ccButton").addClass("ccOff").removeClass("ccOn"); // some generic UI } elseif (status ==="SUBSCRIPTION_UNSUBSCRIBED") {this.ccEnabled =false; // a flag to remember$("#ccButton").addClass("ccOn").removeClass("ccOff"); // some generic UI }console.log("CC: Subscribe Status: "+ status +". Message: "+ message +". Code: "+ code); },});
Stop Service
In order to stop the service, you have to call /stopClosedCaptioning WebServices API and Unsubscribe from the Topic. For this, you need the JWT token and subscriptionToken you used to subscribe earlier.