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

Passing the media id to adv


Hello,
we set up a jwplayer with playlist and googima advert tag.
We'd like to know if there's a way to pass the playlist mediaid to our adv on playlist item change.

thank you

Daniel

8 Community Answers

Todd

JW Player Support Agent  
0 rated :

Hi Daniel,

Our API’s onPlaylistItem call will run each time a new video from a playlist is loaded:

jwplayer().onPlaylistItem(function(){
console.log(jwplayer().getPlaylistItem().mediaid);
});

You can see the other API calls that pertain to the playlist at http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference#playlist

Hope this helps,
Todd

daniele.murroni

User  
0 rated :

Hi Todd, thank you for anwser.

Since the adv tag is setup at player boot and it is unique for the whole playlist, we'd like to know if there is a macro parameter on the tag adv that the player could substitute automatically on every play (like what the player do with theMedia Id Replacement on the sharing overlay as per http://support.jwplayer.com/customer/portal/articles/1409823-social-sharing-overlay )

Our goal is to have a tag with this different parameter foreach video, so the adserver can recognize it and deliver different contents.

Thank you.

Daniel

Todd

JW Player Support Agent  
0 rated :

In that case, you would probably need to write an if statement inside of the onBeforePlay() call to check the index of each video to play a new ad at the beginning.
Here’s a sample where I use a variable to make sure the ad only plays once at the beginning of each playlist item:

var playedAd1 = false; var playedAd2 = false; var playedAd3 = false;

jwplayer().onBeforePlay(function(){

var checkIndex = jwplayer().getPlaylistIndex();
if (checkIndex == 0 && playedAd1 == false ) {
playedAd1 = true;
jwplayer().playAd(‘first ad tag URL’);
}

if (checkIndex == 1 && playedAd2 == false ) {
playedAd1 = true;
jwplayer().playAd(‘second ad tag URL’);

}

if (checkIndex == 2 && playedAd3 == false ) {
playedAd2 = true;
jwplayer().playAd(‘third ad tag URL’);
}

});

daniele.murroni

User  
0 rated :

thank you todd!
It's exactly what I was looking for :)

Many thanks.

daniele.murroni

User  
0 rated :

hi Todd,
I did some test and I noticed that since we are using google ima adv, the "playAd" function on jwplayer is not supported

Do you have any suggestion to make this working with googima?

thanks

Todd

JW Player Support Agent  
0 rated :

playAd() with a googima tag will be supported in Flash mode with JW Player 6.9.

daniele.murroni

User  
0 rated :

Thanks Todd.
Do you have an idea about the release date?

Todd

JW Player Support Agent  
0 rated :

I just e-mailed you an update.

This question has received the maximum number of answers.