Documentation

Example of code which plays Pre, Post ads from flashvars

1. Open index.html in your favorite editor.

2. You will be able to find the following code snippet.

<div name=’mediaspace’ id=’mediaspace’>

<script type=”text/javascript”>

var s1 = new SWFObject(‘HD FLV Player /hdplayer.swf’, ‘player’, ’640′, ’360′, ’9′);

s1.addParam (‘allowfullscreen’, ‘true’);

s1.addParam (‘allowscriptaccess’, ‘always’);

s1.addParam (‘wmode’, ‘transparent’);

s1.write (‘mediaspace’);

</script>

3. Add the below line next to s1.addParam (‘mode’, ‘transparent’);

s1.addVariable(‘file’, ‘Your video file path goes here’);

s1.addVariable(‘hdpath’, ‘Your HD file path goes here’);

s1.addVariable(‘pre-roll_ads’, ‘true’);

s1.addVariable(‘pre-rollad’, ‘Your ad video goes here’);

s1.addVariable(‘pre-rolltrageturl’, ‘your ad sponsor’s page link goes here’);

s1.addVariable(‘post-roll_ads’, ‘true’);

s1.addVariable(‘post-rolladd’, ‘your ad video goes here’);

s1.addVariable(‘post-rolltargeturl’, ‘your ad sponsor’s page link goes here’);

s1.addVariable(‘mid-roll_ads’, ‘true’);

4. Your final code will look as following,

<div name=’mediaspace’ id=’mediaspace’>

<script type=”text/javascript”>

var s1 = new SWFObject(‘HD FLV Player /hdplayer.swf’, ‘player’, ’640′, ’360′, ’9′);

s1.addParam(‘allowfullscreen’, ‘true’);

s1.addParam(‘allowscriptaccess’, ‘always’);

s1.addParam(‘wmode’, ‘transparent’);

s1.addVariable(‘file’, ‘Your video file path goes here’);

s1.addVariable(‘hdpath’, ‘Your HD file path goes here’);

s1.addVariable(‘pre-roll_ads’, ‘true’);

s1.addVariable(‘pre-rollad’, ‘Your ad video goes here’);

s1.addVariable(‘pre-rolltrageturl’, ‘Your ad sponsors page link goes here’);

s1.addVariable(‘post-roll_ads’, ‘true’);

s1.addVariable(‘post-rollad’, ‘Your ad video goes here’);

s1.addVariable(‘post-rolltargeturl’, ‘Your ad sponsor’s page link goes here’);

s1.addVariable(‘mid-roll_ads’, ‘true’);

s1.write(‘mediaspace’);

</script>

5. Open config.xml and edit the following attributes and save the file.

pre-roll_ads = “true”

mid-roll_ads = “true”

post-roll_ads = “true”

6. Run index.html in your favorite browser.

Related Posts via Categories