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

How to load the vast xml in the Ima ads Player?

Open Anas-mirza912 opened this issue 1 year ago • 4 comments

Hi Team,

Could you please confirm if there's a way to load a VAST XML into the VideoAdPlayer? We managed to load it earlier in the ExoPlayer using Util.getDataUriForString("text/xml",imaAdsResponse.staticVmap) but we're unable to find a method to load the VMAP XML in the native VideoAdPlayer.

Anas-mirza912 avatar Mar 26 '24 09:03 Anas-mirza912

Hello @Anas-mirza912 ,

I think you should be able to create an ad request with a VAST XML string, instead of a URL if you use AdsRequest.setAdsResponse() instead of .setAdTagUrl().

Typically this issues queue is for issues directly related to the sample apps, but I am happy to answer any follow-up questions you have.

If you have more in-depth questions on IMA functionality, I recommend reaching out on the IMA SDK technical forum.

Thank you, Jackson IMA SDK team

Kiro705 avatar Mar 26 '24 15:03 Kiro705

Hi @Kiro705

Thanks for the instant response,

I'm using request.setAdsResponse(vastXml) to request ads, but I don't want the ad to play immediately after the request. However, the IMA ads SDK automatically triggers CONTENT_RESUME_REQUESTED after requesting ads.

My goal is to preload the ad in the background and play it only under specific conditions. Is there a way to achieve this functionality?

Additionally, I'm interested in showing two ads to the user simultaneously. Could you please verify if the VMAP format supports playing two ads concurrently?

Published the same in the IMA SDK technical forum. also.

Here is the vmap xml for testing purpose

                                  <vmap:AdBreak timeOffset="start" breakType="linear" breakId="preroll">
                                    <vmap:AdSource id="preroll-ad-1" allowMultipleAds="true" followRedirects="true">
                                      <vmap:AdTagURI templateType="vast3">
                                        <![CDATA[https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=]]>
                                      </vmap:AdTagURI>
                                    </vmap:AdSource>
                                  </vmap:AdBreak>
                                   <vmap:AdBreak timeOffset="start" breakType="linear" breakId="preroll">
                                    <vmap:AdSource id="preroll-ad-2" allowMultipleAds="true" followRedirects="true">
                                      <vmap:AdTagURI templateType="vast3">
                                        <![CDATA[https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=]]>
                                      </vmap:AdTagURI>
                                    </vmap:AdSource>
                                  </vmap:AdBreak>
                                </vmap:VMAP>

Thank you, Anas

Anas-mirza912 avatar Mar 27 '24 05:03 Anas-mirza912

I've encountered an issue with ad playback in the Google IMA SDK Basic Sample. Here are the reproduction steps:

Use request.setAdsResponse(vastXml) to load the ads. Move the request ads in the onCreate method. Remove adsManager.start(); from the LOADED event. After following these steps, the ad continues to play without explicitly calling adsManager.start();

Could you please guide on resolving this issue?

Thank you, Anas

Anas-mirza912 avatar Mar 27 '24 06:03 Anas-mirza912

Hello @Anas-mirza912 ,

This is working as intended, see the comment starting on line 143.

// This sample app uses the sample tag
// single_preroll_skippable_ad_tag_url that requires calling
// AdsManager.start() to start ad playback.
// If you use a different ad tag URL that returns a VMAP or
// an ad rules playlist, the adsManager.init() function will
// trigger ad playback automatically and the IMA SDK will
// ignore the adsManager.start().
// It is safe to always call adsManager.start() in the
// LOADED event.

I am a little confused by what you mean by, show ads simultaneously. I think with the VMAP you shared, it will show two pre-roll ads, one after the other. IMA does not support showing multiple ads at the same time.

For trigger ad breaks manually, please look at this manual ad break guide for more information.

Thank you, Jackson IMA SDK team

Kiro705 avatar Mar 28 '24 14:03 Kiro705