6

I want to integrate Audio ads into my podcast app with the interval of 3 podcasts. After every 3 podcasts, I need one specific ad to play which could be skippable or non-skippable.

For integration, I have gone through exoplayer official docs of ad insertion and also found exoplayer IMA extension

In IMA integration docs, I found the following code snippet

MediaSourceFactory mediaSourceFactory =
    new DefaultMediaSourceFactory(dataSourceFactory)
            .setAdsLoaderProvider(unusedAdTagUri -> adsLoader)
            .setAdViewProvider(playerView);

In above code, there is setAdsLoaderProvider which takes ImaAdsLoader as per docs. But setAdsLoaderProvider is deprecated and instead of that we need to use setLocalAdInsertionComponents which takes AdsLoader.Provider as an argument as per docs here.

Here I found one medium article for the same but, in that also facing some issues and not clear enough because after that so many things have been changed in exoplayer.

Also in all these official docs and articles, they initialize and prepare exoplayer at the same time. In my case, I want to initialize exoplayer when the service bind to the app and play exoplayer on some specific button clicks.

Does anyone have implemented this or done some research on this?

Thank you in advance!

krupa parekh
  • 607
  • 3
  • 16
  • Is the ad something you have created yourself or do you want to download and Play the ad from some 3rd party ad server? – Mick Feb 21 '23 at 12:03
  • @Mick Right now we have used 3rd party to get ad, the backend guy will provide me some ad-tagURL and that I am using in my player – krupa parekh Feb 21 '23 at 12:17
  • Consider integrating audio ads with ExoPlayer by adding the ExoPlayer IMA extension to your project and initializing the player with a MediaSource that represents your audio content, along with setting up the player's AdsLoader and AdViewProvider. also, handle ad events using AdsLoadedListener and add a skip button to the AdViewProvider's view group to allow users to skip the ad – Goran Feb 26 '23 at 18:41
  • @Goran It turns out you cannot set MediaSource to exoplayer if you want ads. You have to set MediaItems to exoplayer. – krupa parekh Feb 27 '23 at 05:34

0 Answers0