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

Ad plays before each item in the playlist


I have a JWPlayer setup that has a playlist and a single ad tag. I'm currently seeing that ad play before each item in the playlist. Is that the expected behavior? I thought that the ad would only play before the first item in the playlist.

7 Community Answers

George

JW Player Support Agent  
0 rated :

That is expected behavior. To setup ads per playlist item you need something like this:
playerone.setup({
playlist:[
{
file:“http://content.jwplatform.com/manifests/nJEIV3eJ.m3u8”,
adschedule: {
adbreak1: {
offset: “pre”,
ad: {
tag: “http://demo.jwplayer.com/android/vast-tags/preroll.xml”
}
},
adbreak2: {
offset: 5,
ad: {
tag: “http://demo.jwplayer.com/android/vast-tags/preroll.xml”
}
}
}
}
],
width:“80%”,
aspectratio:“16:9”,
advertising: {
client:“vast”,
}
});

s...

User  
0 rated :

Hey George,

Thanks for your answer. Is it possible to specify a playlist from jwplatform (eg "playlist": "https://content.jwplatform.com/feeds/XXXXXX.rss") and still create an ad schedule on the page like that?

George

JW Player Support Agent  
0 rated :

Well, you could request / download the playlist outside of the player then traverse through the JSON and add the extra fields in theory, but I don’t think you can do it with the RSS version.

s...

User  
0 rated :

Yeah, I was thinking I could do that with the JSON version. Would I have to make an ajax call to retrieve it or is there a better way to do it with your javascript api?

George

JW Player Support Agent  
0 rated :

Well, You could do Ajax, or XMLHttpRequest() to retrieve the JSON, or setup the player with the JSON, then on(‘ready’) use jwplayer().getConfig(), edit the items in the playlist then finally call setup again. I couldn’t say which one is faster, but in general you’ll probably want to preprocess the playlist before sending it to the website. So maybe Ajax?

s...

User  
0 rated :

I didn't realize you could call setup a second time on the player, do you guys have a demo or example for what that looks like?

Thanks for your help.

George

JW Player Support Agent  
0 rated :

var player = jwplayer(‘container’);
player.setup(YOUR_CONFIG);
player.setup(A_MODED_CONFIG);

This question has received the maximum number of answers.