
Unable to make the events work
Hello.
We would like to detect when the ad is displayed (and what kind of ad we are displaying) to be able to pause the html5 player, just like happens with the overlay ads when using the flash player.
What we can't.
//Our code, based on 6.12.4945 version
jwplayer.key="OUR_KEY_CODE";
var playerInstance = jwplayer("Vid_NumXXX").setup({
file: "http://videos.example.com/video_file.mp4"
,image: "http://imag.example.com/video_file.jpg"
,skin: "bekle"
,bufferlength: "15"
,aspectratio: "16:9"
,width: "100%"
,autostart: true
,primary: "flash"
,logo: {
file: 'http://static.example.com/logo.png'
,link: 'http://www.example.com/'
,linktarget: '_blank'
,hide: false
,position: 'top-right'
}
,advertising: {
client: 'vast'
,schedule: {
adbreak1: {
offset: "2"
,"http://www.example.com/VAST_FILE.xml?url=__page-url__&correlator=__timestamp__" :
,type: "nonlinear"
}
}
}
});
//************************************************
//Example One:
//Error: the events don't work
function onAdPlay(event) {
console.log('AdPlay');
}
function onAdTime(event) {
console.log('onAdTime');
}
function onAdSkipped(event) {
console.log('onAdSkipped');
}
playerInstance.onAdPlay(onAdPlay); //jwplayer().
playerInstance.onAdTime(onAdTime);
playerInstance.onAdSkipped(onAdSkipped);
//************************************************
//Example two:
//Error: the events don't work
function onAdPlay(event) {
console.log('AdPlay');
}
function onAdTime(event) {
console.log('onAdTime');
}
function onAdSkipped(event) {
console.log('onAdSkipped');
}
jwplayer().onAdPlay(onAdPlay);
jwplayer().onAdTime(onAdTime);
jwplayer().onAdSkipped(onAdSkipped)