google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.7k stars 6.01k forks source link

IMA: Support manual ad break timing #9839

Open takahirom opened 2 years ago

takahirom commented 2 years ago

I saw in the following document that I can control the ad break playback timings, but I don't have access to the adsManager in the IMA extension, so I can't control it? If there is a way to do this, I would like to know about it. https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/manual_ad_playback

@Override
public void onAdEvent(AdEvent adEvent) {
    ...
    switch (adEvent.getType()) {
      // Listen for the AD_BREAK_READY event.
      case AD_BREAK_READY:
        // Tell the SDK to play ads when you're ready. To skip this ad break,
        // simply return from this handler without calling adsManager.start().
        adsManager.start();
        break;
      ...
ojw28 commented 2 years ago

This is not something we support currently, and it's unlikely we'll get round to adding support in the near future. Marking as a feature request nevertheless.

victorsouza19 commented 1 year ago

@ojw28, Do you have any update about this issue? I'm currently using IMA SDK to show ads on ExoPlayer, and this enhancement would be very interesting.

marcbaechinger commented 1 year ago

As mentioned above I don't think this is something we are going to implement any time soon.

I actually don't really understand how this fits into the purpose of the IMA extension of ExoPlayer.

The main purpose of the IMA extension is to map the ads to the internal period structure of the player. This allows the player to for instance add ad markers to the timeline, to mark a given period as being an ad and output this with the analytics listener. The integration into the internal media structure of the player then allows to for instance prevent a user from seeking while the ad is playing and to snap back to play an ad when a user seeks over a given position.

If you want to tell yourself when an ad should start this is not really possible because the player wouldn't know when you start the ad.

Can you give me some context why and how you would use the extension in such a case? What advantage or features of the extension are you wanting to leverage, if you control ad playback yourself?