Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The VideoPlayerCollection object is used to add, remove or connect to a player. You will need to connect to the player using this object if you wish to interact with it via the JavaScript API. However, before you can connect to the player, you will need to assign it a unique DOM-ID.

Perform the following steps:

1   Determining the Embed Code

First, copy the desired embed code from your VideoManager.

VideoManager Pro

In the VideoManager Pro embed codes can be found in the accordion menu Publish.


VideoManager 6

In the VideoManager 6 you will find the embed code via the function "Publish videos".

Note

Please note the conditions that allow you to work with the JavaScript API are:

  • the products HD2 and player version 5 must be enabled for your VideoManager
  • in the Player Generator, the video player pro as well as the option "HTML5 first" must be activated under "Settings".




2   Assigning a DOM-ID

Embed codes which are generated in the VideoManager Pro front end or through the API will not automatically contain a DOM-ID. You need to add this manually so that the player can be individually identifiable.

Original Embed Code without DOM-ID

Sample embed code from VideoManager Pro

Panel
bgColor#DCDCDC
borderStylenone

<div mi24-video-player video-id="BtsxAsZixmFJ-jwB3qv4kx"" player-id="EfXiiqAU9_6dW9119q4aAX" config-type="vmpro" flash-path="https://e.video-cdn.net/v2/" api-url="https://d.video-cdn.net/play" style="width: 799px"></div><script src="https://e.video-cdn.net/v2/embed.js"></script>


Sample Embed Code from VideoManager 6

Panel
bgColor#DCDCDC
borderStylenone

<div mi24-video-player video-id="1037756" player-id="49942" config-type="vm"     flash-path="//e.video-cdn.net/v2/"     api-url="//api.edge-cdn.net/rest/latest"></div>

<script src="//e.video-cdn.net/v2/embed.js" type="text/javascript"></script>


Embed Code with DOM-ID

In the following example, the DOM-ID "foobar" is added to the standard HTML embed code.

Panel
bgColor#DCDCDC
borderStylenone
<div id="foobar" mi24-video-player video-id="string1" player-id="string2" config-type="vmpro" flash-path="//e.video-cdn.net/v2/" 
api-url="//d.video-cdn.net/play"></div><script src="//e.video-cdn.net/v2/embed.js"></script>


3   Connecting to the Player

After  the DOM-ID "foobar" has been added to the embed code, you can connect to the player using the following function:

Panel
bgColor#DCDCDC
borderStylenone
var Player = VideoPlayer.Collection.getPlayerById("foobar");
Note

Please note that you must wait for the player to load before you can connect to it. If lazy loading is enabled, the player will not load until a user clicks play. Find more information on lazy loading here.