VdoPlayer Embed code
The embed code#
<div id="embedBox" style="width:1280px;max-width:100%;height:auto;"></div><script> (function(v,i,d,e,o){v[o]=v[o]||{}; v[o].add = v[o].add || function V(a){ (v[o].d=v[o].d||[]).push(a);};if(!v[o].l) { v[o].l=1*new Date(); a=i.createElement(d), m=i.getElementsByTagName(d)[0];a.async=1; a.src=e; m.parentNode.insertBefore(a,m);}})(window,document,"script","https://player.vdocipher.com/playerAssets/1.6.10/vdo.js","vdo");vdo.add({ otp: "REPLACE WITH OTP", playbackInfo: "REPLACE WITH PLAYBACKINFO", theme: "9ae8bbe8dd964ddc9bdb932cca1cb59a", container: document.querySelector( "#embedBox" ),});</script>The embed code consists of three parts:
- create a container for video
- load the init script
- Setting up global
vdoobject to hold loaded videos. - Initialize with video information.
The above is a generic embed code that should work almost everywhere. In more specialized cases, you may be interested in using it differently to suit your workflow.
Angular or React or any "single-page-app": How to setup on SPA
Getting reference to the video player#
The above script creates a window.vdo object which is an object which
maintains the list of all loaded videos. vdo.getObjects() will return an array
consisting of all video instances in the order in which it was created. If you
are creating multiple video instances without page reload (via ajax), you should
take care to refer to the correct video object. In most cases, it will the last
element in the returned array.
var videos = vdo.getObjects();var video = videos[videos.length - 1];JS API reference#
Reference is the place we aggregate all methods and properties in an organised way. It is not supposed to be illustrative but is the exhaustive list. It contains everything that you can use in a tabular format.
Use the link on the header of this page to explore the API reference.
Server reference#
If you are looking for API reference for managing your VdoCipher account or to obtain auth tokens via API, head over to the server API page.