Skip to content

How do I use my embed code?

Our embed code is a mixture of Javascript and HTML which needs to be pasted into the source code of your page, it will then generate a player for you.

The following is the basic outline for the Asset TV embed code:

<!-- embed this script in the head of your page-->
<script type="text/javascript" id="site_embed" src="//platform.asset.tv/embed.js"></script>
     <script>
        var player = new Player({
          secureCode: "#########",
          region: "UK",
          media: [{
             containerId: "player",
             videoId: ######,
             autoplay: true,
             skipTo: 30,
             size: {
               width: "852",
               height: "480"
             }
          }]
         });
      </script>

 <!-- Place div where you would like player to appear -->
 <div id="player"></div>

Player Options

secureCode

This is the unique identifier for your Asset TV player allowing control of the content available in the player and to record MI (management information) specific to that player.

region

This will be set when the code is supplied to you and will either be "UK" or "US" depending on your location.

containerId

this can be set to anything you wish providing you update the div id at the end of the above code to match it. You may wish to alter this if other objects on the page have already used player for its ID.

videoID

This variable specifies which video should be played when the site loads - this should be included with your embed code when supplied.

autoplay (optional)

This lets the player know if it should start the content once loaded, or wait for the viewer to click to view. It can be toggled between "true" (will play once loaded) or "false" (await user interaction).

Warning

Most browsers have changed the way that autoplayed media is handled, as such most content will start playing but the sound will be muted if autoplayed.

skipTo (optional)

The skipTo property allows the content to begin at a specific point within the video. The value of skipTo defines the amount of seconds that is to be skipped. For example, skipTo: 120; would start the video 2 minutes in. This property can be overridden in the URL with ?skipTo=30 meaning you can provide links that take the viewer to exact moments in the video you wanted to highlight.

Size - width, height (optional)

This allows you to override the player dimensions. By default our player will fill the container in which it is placed.


Info

If you don"t wish to change any of the optional settings (i.e. size, autoplay etc.) you can simple remove or comment out that line of code.

Embedding

  1. First, you need to place the embed script that was supplied to you within the <head></head> tag of your webpage.
  2. Then, you need to create a div with an id within your <body></body> tags at the location you would like this video to appear. The script will reference the div ID name. e.g <div id="player"></div>.
  3. Next you need to set the containerID in the script we placed in the <head> tag to the same as the div id. For example, we set <div id="player"></div> - therefore we need to set containerID = "player"; in your embed code.

Example

The following is an example embed code with the videoID ####. Please note, if you do not follow the format shown below your media may not display properly.

<html>
   <head>
      <script type="text/javascript" id="site_embed" src="https://platform.asset.tv/embed.js"></script>
      <script>
         var player = new Player({
            secureCode: "###########",
            region: "UK",
            media: [{
               containerId: "player",
               videoId: ######,
               autoplay: true,
               skipTo: 30;
             size: {
               width: "852",
               height: "480"
               }
            }]
         });
      </script>
   </head>
   <body>
      <div id="player"></div>
   </body>
</html>