Hi guys,
I'm trying to get a pre-roll ad, the main video, and then a post-roll ad on each play. Here's my code:
$f('pes-tv-player', 'flowplayer/flowplayer-3.1.1.swf', {
'canvas': {
'backgroundColor': '#000000'
},
'plugins': {
'controls': {
'progressColor': '#000000',
'sliderGradient': 'none',
'bufferColor': '#616161',
'borderRadius': '10',
'durationColor': '#ffffff',
'tooltipTextColor': '#ffffff',
'buttonOverColor': '#728B94',
'volumeSliderGradient': 'none',
'progressGradient': 'medium',
'bufferGradient': 'none',
'timeBgColor': '#555555',
'backgroundColor': '#000000',
'volumeSliderColor': '#000000',
'buttonColor': '#454c59',
'timeColor': '#abb8cf',
'tooltipColor': '#5F747C',
'sliderColor': '#000000',
'backgroundGradient': 'low',
'height': 24,
'opacity': 1.0
}
},
'clip': {
'autoPlay': false,
'onStart': function(clip) {
if(clip.isInStream) return;
$$('div.pes-tv .element a').removeClass('playing').removeClass('paused');
$$('div.pes-tv .element a[href="'+clip.url+'"]').addClass('playing');
},
'onPause': function(clip) {
if(clip.isInStream) return;
$$('div.pes-tv .element a').removeClass('playing').removeClass('paused');
$$('div.pes-tv .element a[href="'+clip.url+'"]').addClass('paused');
},
'onResume': function(clip) {
if(clip.isInStream) return;
$$('div.pes-tv .element a').removeClass('playing').removeClass('paused');
$$('div.pes-tv .element a[href="'+clip.url+'"]').addClass('playing');
},
'playlist': [{
'url': 'preroll.jpg',
'duration': 5,
'position': 0,
'linkUrl': 'http://www.google.com',
'linkWindow': '_blank'
}, {
'url': 'postroll.jpg',
'duration': 5,
'position': -1,
'linkUrl': 'http://dfr.me',
'linkWindow': '_blank'
}
]
}
});
$$('a.video').addEvent('click', function(event) {
if(event) event.stop();
var href = this.get('href');
$f('pes-tv-player').play(href);
});
As you can see, there's some MooTools code controlling the 'playlist'-style functionality, but the core problem is that.. the postroll ad plays, then stops. Then if I click to play again, the preroll ad shows, then the main one, then that's it.
Is there some problem I'm unaware of with using playlists like this?
Any help is infinitely appreciated - thanks.