Adding events in Kaltura
Posted By : Pulkit Chadha | 19-Sep-2016
In this blog I am going to explain how you can add events like video start, video complete ,ad cue point reached, ad start , ad complete etc.
Step 1: First setup kaltura in your application.
<script src="http://cdnapi.kaltura.com/p/{pId}/sp/{partnerId}00/embedIframeJs/uiconf_id/{uiconfId}/partner_id/{partnerId}"></script>
Step 2: write the code given below
kWidget.addReadyCallback(function (playerId) { var kdp = document.getElementById(playerId); //kBind method is used to add listener to the player to listen to specific events happened in the player, such as the video is playing or is paused. The opposite of it is kUnbind method. // This event triggeres once per video when first played. kdp.kBind("firstPlay", function () { console.log("video start"); }); // This event triggeres when video has reached the end of content playback. kdp.kBind("playerPlayEnd", function () { console.log("video complete"); }); //This event triggeres when the player's time progress reaches an ad cue point kdp.kBind("adOpportunity", function (qPoint) { console.log("adcuePointReached ", qPoint); }); //This event triggeres when the ad starts to play. kdp.kBind("onAdPlay", function () { console.log("Ad start"); var url = kdp.evaluate('{sequenceProxy.activePluginMetadata}').url; }); //This event triggeres when video has reached the end of content playback. kdp.kBind("onAdComplete", function () { console.log("Ad complete"); var url = kdp.evaluate('{sequenceProxy.activePluginMetadata}').url; }); });
Request for Proposal
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Pulkit Chadha
Pulkit is an expert web app developer and has good knowledge of JQuery, MongoDb, NodeJs, AngularJS, kaltura, Akamai. etc.