Prefetching of Ads

299 views
Skip to first unread message

revathi Muddineni

unread,
Mar 23, 2022, 8:55:56 AM3/23/22
to Interactive Media Ads SDK
Hi,

SDK Version: 'GoogleAds-IMA-iOS-SDK', '~> 3.14.5'

In our app the requirement is to prefetch the ads before the player gets loaded. 
Initially we implemented in a way that player initialise first later ads are requested to play. But as per new requirement now we need to request the ads before the player gets initialised. So I made few changes in the basic example provided by IMA SDK.

In viewDidLoad i have replaced the methods and below are the changes:

override func viewDidLoad() {

    super.viewDidLoad()

    setUpAdsLoader()

    requestAds()

    setUpContentPlayer()

  }

We are requesting for ads first later initialising the content to play. But at the time of ads request we are passing video view as a reference which is loading only in content setup method.

let adDisplayContainer = IMAAdDisplayContainer(

      adContainer: videoView, viewController: self, companionSlots: nil)

 let request = IMAAdsRequest(

      adTagUrl: ViewController.kTestAppAdTagUrl,

      adDisplayContainer: adDisplayContainer,

      contentPlayhead: contentPlayhead,

      userContext: nil)

Because of this facing error as "Ads cannot be requested because the ad container is not attached to the view hierarchy"

Is there any other approach to get this prefetching of ads to be done like for example initially ads will be requested by passing some dummy view to the request later can we replace the view with videoView...

We able to reproduce issue in sample app, above are the changes to be done.

If something is missing or any other info you want me to add please let me know.


Thanks & Regards,

Revathi M.

IMA SDK

unread,
Mar 23, 2022, 11:53:38 AM3/23/22
to revathi94...@gmail.com, ima...@googlegroups.com
Hi Revathi,

Using a dummy view is unsupported currently. Could you state in business terms what the value of offering requesting ads before attaching to view hierarchy? Could you send us a sample that is slightly modified to demonstrate your use case? Would Handling multiple ad requests with UserContext help you?

Regards,

Google Logo
Aryeh
IMA SDK Team
 


ref:_00D1U1174p._5004Q2Yqeyp:ref
Reply all
Reply to author
Forward
0 new messages