Skip to main content

VdoPlayer Embed code

Newer version available

You are seeing documentation of an older player version. Check the embed code for newer player v2. The new player has shorter load-times, more customisable and has a lot of new features.

The embed code

<div id="embedBox" style="width:1280px;max-width:100%;height:auto;"></div>
(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);
theme: '9ae8bbe8dd964ddc9bdb932cca1cb59a',
container: document.querySelector('#embedBox'),

The embed code consists of three parts:

  1. create a container for video
  2. load the init script
  3. Setting up global vdo object to hold loaded videos.
  4. 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.

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.