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!