This article assumes you have already read and understood our article on How do I use my embed code?.

A similar process is required for embedding multiple videos, you will have a script that you can add to your webpage along with multiple <div>s. The script can be added to the <head> or <body> of the document.


First, you need to create a series of <div>s with different ids. For example, if we are embedding three different videos, we could set up the following:


<div id="video1"></div>
<div id="video2"></div>
<div id="video3"></div>


These can then be placed in the HTML of your webpage in the section where the videos are required.

Then, you need to adapt the embed script to accommodate the three <div>s by adding each individual video as an object within the media array. A single object denotes a video. Your secure code is a compulsory value should be added to the embed script. An example of this can be seen below.


<script type="text/javascript" src="http://platform.asset.tv/embed.js"></script>
<script>
var player = new Player({
secureCode: '###########',
media: [
{
containerId: 'video1',
videoId: ######
},
{
containerId: 'video2',
videoId: ######
},
{
containerId: 'video3',
videoId: ######
}
]
}); </script>

 

You can still take advantage of the extra player features by adding the required options from the code found here to the relevant player, for example:
<script type="text/javascript" src="http://platform.asset.tv/embed.js"></script>

<script>
var player = new Player({
secureCode: '###########',
media: [
{
containerId: 'video1',
videoId: ######
autoplay: true
skipTo: 30;
size: {
width: '852',
height: '480'
}
},
{
containerId: 'video2',
videoId: ######
autoplay: false
size: {
width: '640',
height: '360'
}
},
{
containerId: 'video3',
videoId: ######
autoplay: false
size: {
width: '640',
height: '360'
}
]
}); </script>

 
The above example would embed three players onto the page. The first would be larger and would automatically start the video 30 seconds in once loaded. The other two players would play from the beginning of their respective videos but would wait for user interaction before doing so. They have also been sized smaller than the first player.