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

Listening for VAST events


Hi JWPlayer team,

is it possible to listen for specific VAST events, like progress, firstQuartile and such?

For example, you provide onAdClick(callback) in your API, but is there something like onFirstQuartile(callback)?

Best regards,

1 Community Answers

Cooper Reid

JW Player Support Agent  
0 rated :

Hello,

You can do something like this:

jwplayer(“player”).setup({
file: “content.mp4”,
primary: ‘flash’,
advertising: {
tag: ‘ad-tag’,
client: ‘vast’
}
});

jwplayer().onAdTime(function(event){
var remaining = Math.round(event.duration-event.position);
var position = Math.round(event.position);
var quartile = Math.round(event.duration/4);
var first = quartile;
var second = (quartile*2);
var third = (quartile*3);
console.log(“progress”,"The ad completes in “+ remaining +” seconds.“);
if(position==first){
console.log(”firstq",“First Quartile Reached”);
} else if(positionsecond){ console.log("secondq","Second Quartile Reached"); } else if(positionthird){
console.log(“thirdq”,“Third Quartile Reached”);
}
});

Best Regards,
Cooper

This question has received the maximum number of answers.