Handle pre-rool, mid-roll, post-rool Audio Player Background

163 views
Skip to first unread message

Francesco Maggi

unread,
Sep 24, 2021, 6:45:33 AM9/24/21
to Interactive Media Ads SDK
Hi,
I need more information on how add ads (pre, mid and post rool) to a media item in a Audio Player (I've used the exoPlayer lib).

In a video player I can do something like that: 
MediaItem mediaItem = new MediaItem.Builder().setUri(contentUri).setAdTagUri(adTagUri).build();

The player is able to correctly set the pre, mid and post roll autoatically.

How can I do something like that with AdsRequest?

IMA SDK

unread,
Sep 27, 2021, 2:21:34 AM9/27/21
to francesc...@gmail.com, ima...@googlegroups.com

Hi Francesco,

 

Thank you for reaching out to us.

 

By design, the pre, mid and post roll are automatically played in order by the SDK using the Ad Tag url. The ads that will be shown per ad break will depend on what was configured on the VAST. However, if you prefer to have different ad tags per ad break, you may do so by requesting ads again after the previous one was completed. You may check the Lifecycle of the SDK for more information. Additional information here for creating your main ad tag manually or you may contact your ad provider for that.

 

On the other hand, here are the list of properties and methods you may use in using adsRequest.

Regards,

Google Logo
Michael Angelo Legaspi
IMA SDK Team
 


ref:_00D1U1174p._5004Q2OTl8t:ref

Francesco Maggi

unread,
Sep 27, 2021, 6:58:02 AM9/27/21
to Interactive Media Ads SDK
Hi Michael,
I've been working on an Audio Player. 

I read the "https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/background-ad-playback" doc and I studied the "AudioPlayerExample" but the  Ad Tag url isn't use there but the AdRequest is used instead.

I need to playing audio adv in background. Can I use the MediaItem mediaItem = new MediaItem.Builder().setUri(contentUri).setAdTagUri(adTagUri).build() like I saw in "https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side" doc to play audio adv in background?
If I can't, How can I automatically play pre, mid and post roll without manually schedule Ad Request?

Regards.

IMA SDK

unread,
Sep 27, 2021, 1:44:30 PM9/27/21
to francesc...@gmail.com, ima...@googlegroups.com
HI Francesco,

Thank you for reaching out to us with the additional information. In looking over the 2 links that you gave us, I would say that you are best to follow the first one. Which shows how the audio playback is done in the background. As this is the best way to show audio ads with the SDK. At the same time, since you have said that you are developing your own audio player. There is nothing that would stop you from finding a way to pull for the ad Tag if you want to find a way to.

Regards,
Google Logo
William Pescherine
IMA SDK Team
 


ref:_00D1U1174p._5004Q2OTl8t:ref

Francesco Maggi

unread,
Sep 28, 2021, 12:44:33 PM9/28/21
to Interactive Media Ads SDK
Hi William,
Do you have any suggestion? Is it possible to modify this code (https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/background-ad-playback) to find a way to use the adTagUrl?
I would like to thank you in advance for any tips you'll give me.
Regards

IMA SDK

unread,
Sep 28, 2021, 4:53:51 PM9/28/21
to francesc...@gmail.com, ima...@googlegroups.com
Hi Francesco,

Thank you for the response. I was able to look at the link that you gave and to my understanding when looking at the Service sample here . It also talks about how you can create your own audio player and this also seems to use the adTagURL. So from what I can see there is no need to modify it much more then what is there?

Regards,
Google Logo
William Pescherine
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2OTl8t:ref
Reply all
Reply to author
Forward
0 new messages