Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

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)


3 Community Answers

Todd

JW Player Support Agent  
0 rated :

Pausing ads was improved in JW Player 7.0.3. Please try your same code in the updated version.

robertonavarro

User  
0 rated :

Yes we know, but we must stay at this version for the moment. We will face the upgrade later.

Could you help us?

Thanks in advance.

Roberto.

Todd

JW Player Support Agent  
0 rated :

I see in your code example that you are not using onAdImpression() for any reporting. Have you tested with that one? It should be working in both Flash and HTML5 mode.

Our engineers will no longer be making any minor updates to JW6. What is preventing you from upgrading to JW7?

This question has received the maximum number of answers.