Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMA extension: Ads playback without internet connection #3664

Closed
jeevarajp opened this issue Jan 4, 2018 · 3 comments
Closed

IMA extension: Ads playback without internet connection #3664

jeevarajp opened this issue Jan 4, 2018 · 3 comments
Assignees
Labels

Comments

@jeevarajp
Copy link

I am using exoplayer (with IMA) version 2.6.0

I followed exactly same steps in https://medium.com/google-exoplayer/playing-ads-with-exoplayer-and-ima-868dfd767ea blog.

I have video content and advertisement content (ad xml and ad video) in my local intranet. I connected my local intranet wifi from a mobile, so that I can access my video content and ads content without internet.

If I enable internet access to this wifi connection and try to run this application then ads in my local intranet are playing fine.

But If I disable internet access to this local intranet wifi and try to run this application then my ads (which is in local intranet) keep on buffering and not playing at all. When I try to fiddler my mobile traffic I see that IMA sdk tries to request below urls to play ads.

https://imasdk.googleapis.com
https://pagead2.googlesyndication.com

So my question is "Does internet access is necessary to play advertisement using IMA sdk?". Is there any alternative way to play ads without internet connection?

Thanks.

@andrewlewis
Copy link
Collaborator

I think internet access is necessary for using the Android IMA SDK, which our IMA extension depends on. Most of the functionality is implemented in JavaScript, which is loaded from a remote URL in a WebView.

Is using the IMA SDK a requirement for your use case? If not, you can still use ExoPlayer to play ads but using your own implementation of AdsLoader instead of ImaAdsLoader. In this setup you don't need to use the IMA extension but instead inject a custom AdsLoader into AdsMediaSource via its constructor. Your loader is responsible for telling the AdsMediaSource where ads are positioned in the content, the URLs for their media and for marking the ads as played based on player events. Depending on your requirements, you may also need to implement support for tracking what ads have been shown in your loader. I think @marcbaechinger may be able to provide further guidance on this approach. Thanks!

@jeevarajp
Copy link
Author

thanks for your comments @andrewlewis.

@marcbaechinger please give me your guidance here.

@marcbaechinger
Copy link
Contributor

marcbaechinger commented Jan 9, 2018

Yes, the approach Andrew is describing works:

  1. Create your own implementation of AdsLoader and pass it to the AdsMediaSource
  2. in attachPlayer() you create an AdPlaybackState and populate it with the ad groups to play and the presentation time when to play them. The AdPlaybackState is then passed to the AdsLoader.EventListener to make the AdsMediaSource aware of the ads to play:
public void attachPlayer(Player player, EventListener eventListener, 
   ViewGroup adUiViewGroup) {
    AdPlaybackState playbackState = new AdPlaybackState(numberOfAdGroups]);
    // whatever code it needs here to populate the ad playback state
    /// ....
    eventListener.onAdPlaybackState(playbackState);
}

@google google locked and limited conversation to collaborators Jun 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants