googleads-ima-android icon indicating copy to clipboard operation
googleads-ima-android copied to clipboard

ImaAdsLoader.getAdsLoader() is returning a null value in media3

Open ThirupathiiBalaji opened this issue 1 year ago • 11 comments

Problem statement: The pre-roll or mid-roll advertisement plays when the app minimizes and then the onresume function calls again. To fix this, we must skip the specific ad to prevent repeat playback of the advertisement. The only way to resolve this situation is to use admangaer. However, ImaAdsLoader getAdsLoader() is returning a null value in media3. Kindly help us to fix this null value issue or provide us alternative solution to skip video ad

Note: This issue occurs when we migrating to media3 1.4.1 from exoplayer 2.11

ThirupathiiBalaji avatar Sep 27 '24 09:09 ThirupathiiBalaji

Hello @ThirupathiiBalaji ,

Can you confirm which IMA Android integration you are using? Standard implementation or ExoPlayer-IMA extension?

The AdsLoader should be obtained like this for a standard implementation:

adsLoader = sdkFactory.createAdsLoader(this, settings, adDisplayContainer);

Please let me know if you have additional questions.

Thank you, Jackson IMA SDK team

Kiro705 avatar Sep 27 '24 16:09 Kiro705

Hi @Kiro705 , I work on a project that uses the ExoPlayer-IMA extension. As per our management requriement, in order to provide a good user experience, we have to skip the current advertisement without any user interaction in the scenario above. however, ImaAdsLoader.getAdsLoader() always returns null value. Actually the following function should not return ImaAdsLoader.getAdsLoader() null value. currently we are using exoplayer 2.11 in our project where the mentioned function didn't return null value.

ThirupathiiBalaji avatar Sep 30 '24 04:09 ThirupathiiBalaji

Hello @ThirupathiiBalaji ,

Thank you for clarifying that you are using the Exoplayer-IMA extension. You should obtain a reference to the AdsLoader when it is constructed. See this section from the ExoPlayer example for details.

That said, the IMA SDK only allows the use of AdsManager.skip() to be used if the ad is skippable, and IMA does not render its own skip button.

Please let me know if you have any questions.

Thank you, Jackson IMA SDK team

Kiro705 avatar Oct 01 '24 14:10 Kiro705

Hi @Kiro705 , Problem statement:

 That ImaAdsLoader itself has a AdsLoader instace which can be retrived using ImaAdsLoader.getAdsLoader()
 
**((ImaAdsLoader)adsLoader).getAdsLoader()**.addAdsLoadedListener(adsManagerLoadedEvent -> {
    });
 getting null for the above hightlighted one(**).
 
 Actual problem : a pop-up will appear when the user hits the share button while they are watching a movie. Ads begin to play automatically (even we are not sending any ad request) after users close the pop-up window. Please give us a solution to this type of unwanted ad-triggering problem. 

ThirupathiiBalaji avatar Oct 03 '24 05:10 ThirupathiiBalaji

Hello @ThirupathiiBalaji ,

I cannot say if the behavior of getAdsLoader() returning null is a bug. Would you be able to share code changes to the IMA ExoPlayer extension sample app to reproduce the issue?

As for the actual problem, are you saying closing the pop-up always triggers an ad break? Or that the movie is playing while the share pop-up is present, and sometimes an ad break triggers during this time? I am not aware of any IMA functionality that would trigger an ad break based on pop-up behavior. If it is the other case, a solution could be to pause the movie while showing the pop-up.

Kiro705 avatar Oct 03 '24 15:10 Kiro705

Hi @Kiro705 I'm not trying to say alert triggers the ad request, to be more clear about the issue, In our project while content is playing whenever the onResume is called we clear the previous player instance.

Then we will reconstruct the player with an updated new URL, why we are doing this because in-between onPause and onResume is called the previous URL might be expired so we are reconstructing the player with a new URL since we are reconstructing the player, the ad will be automatically triggered but it will affect our app's user experience so we used to skip that particular ad without any user interaction even though if the ad is non-skippable Since then we updated to Media3 we can't able to skip the ad as we did in exoplayer 2.11, this will affect our app user experience.

So kindly offer us a solution to fix this issue.

ThirupathiiBalaji avatar Oct 07 '24 05:10 ThirupathiiBalaji

Hello @ThirupathiiBalaji ,

A recent change introduced in IMA Android v3.32.0 only allows skipping the ad when it is defined as skippable, and IMA does not render a skip button. However, right now there is not a publicly available option to prevent IMA from rendering the skip button. To summarize, I think the use-case you are describing is not currently supported by the IMA SDK.

There are some updates planned that will offer more customizability for the ad UI, and control of when ads are skipped. However, I do not have any timelines for when that might be available.

I would recommend reaching out on the IMA technical forum to make a feature request to support your use-case.

Thank you, Jackson IMA SDK team

Kiro705 avatar Oct 07 '24 14:10 Kiro705

Hi @Kiro705 Regarding the ad skip, we'll look into other options. I have one more query regarding the ad cue points. We are using vmap in our project. We used to retrieve the cue points list using adManager in exoplayer 2.11. Since we just upgraded to media3, could you please explain how we obtain the cue points list in media3?

ThirupathiiBalaji avatar Oct 08 '24 06:10 ThirupathiiBalaji

Hello @ThirupathiiBalaji ,

The ExoPlayer IMA extension does not surface a way to access the IMA CuePoints. Typically this can be done with AdsManager.getAdsCuePoints(). However, the extension does access this information, and renders UI elements for the ad breaks on the timeline. See screenshot. Screenshot 2024-10-08 at 1 46 07 PM

If you need to access the ad cue-points, I would recommend not using the extension for your IMA integration.

Thank you, Jackson IMA SDK team

Kiro705 avatar Oct 08 '24 17:10 Kiro705

Hi @Kiro705 Our project uses a customized progress bar. Is it possible to update cue points in a customized progress bar? Please provide us solution.

ThirupathiiBalaji avatar Oct 10 '24 05:10 ThirupathiiBalaji

Hello @ThirupathiiBalaji ,

The ExoPlayer-IMA extension is built to provide an easy to set up integration with ExoPlayer and IMA SDK. Such that it does things like cuepoints on the progress bar itself.

For a more custom integration, like the one you are describing, I would recommend not using the extension. An integration similar to the AdvancedExample would highlight this approach.

Kiro705 avatar Oct 10 '24 17:10 Kiro705