[iOS] Best practices for loading multiple unique ads inline in a UICollectionView/Cell

100 views
Skip to first unread message

Jonathan Lee

unread,
Apr 26, 2021, 1:12:13 PM4/26/21
to Interactive Media Ads SDK
TLDR:
* Following the documentations and examples, there is no clear indication on how to approach this problem following best practices

Note: 
* We have this already working using a different VAST compatible sdk but we want to switch to the IMA sdk but it looks we we won't be able to support our use very well

First off, is there anything in the below use case which this SDK will NOT be able to support?

Use case:
* Loading multiple ads inline in a UICollectionView via UICollectionViewCell
* Ads should be able to "auto" play/pause based on 50% viewabilty (we calculate this using the cell's position relative to the visible UICollectionView)
* You should be able to resume ads that have previously been paused ideally without any loading/buffering. ie. load collection view, scroll to first ad, let it play a little, scroll down to a second ad (first ad should pause when its 50% offscreen), let the second play a little, scroll up back to the first ad (second ad should pause when 50% offscreen), first ad should resume playback at the paused point....etc
* Ads should begin muted with the ability to unmute be tapping on a mute/unmute button
* Tapping on an ad should pause a playing ad/play a paused ad
* We have a server API which requests a feed to be displayed in a UICollectionView, it essentially will dictate in what positions we want to dynamically display ads
* Given a model with `impressionId` (string unique identifier,) and an `url` (string ad server url), we can uniquely track/log actions like autoplaying/pausing/manually pausing an ad, completing an ad, error logging and things like collapsing an ad cell upon error/completion, etc

Our current implementation essentially requests/caches media units where we just have to load them into a single instance of a player which just gets added as a subview in a UICollectionViewCell.

Using this sdk we encountered the following problems so far are:
1. Using the recommended single instance of `IMAAdsLoader`, in the `IMAAdsLoaderDelegate` `func adsLoader(_ loader: IMAAdsLoader!, adsLoadedWith adsLoadedData: IMAAdsLoadedData!) {}` callback, we have no way to identify which ad was loaded. In our use case; we load our feed, scroll down enough to view 2 ads, we make 2 requests, but perhaps ad 2 finishes loading before ad 1. We would like to use our `impressionId` to uniquely track which ad has loaded but theres no way to know
2. Same problem as above but for the error case, out 2 `IMAAdsRequest`, which one failed?

I have a feeling if we created a class which has our `impressionId` and its own instance of `IMAAdsLoader` and conform to the `IMAAdsLoaderDelegate`, we could handle our use case except that it goes against the best practice of having a single loader app wide loader. This way we can uniquely track/log each individual loading of ads.

I have several follow up questions but I just wanted to start this thread off to see if I can get any responses on this.

Thanks!





IMA SDK

unread,
Apr 26, 2021, 4:46:42 PM4/26/21
to jonath...@shopkick.com, ima...@googlegroups.com
Hi Jonathan,

Thank you for bringing up to us your use case. Because we don't have a sample that fits your use case of many separate video views in a UICollectionView via UICollectionViewCell I will bring your questions to my team and we will get back to you as soon as possible.

Regards,

Google Logo
Aryeh Baker
IMA SDK Team
 


ref:_00D1U1174p._5004Q2GHerG:ref

Jonathan Lee

unread,
Apr 26, 2021, 4:49:05 PM4/26/21
to Interactive Media Ads SDK
Hey there,

Looking forward to it. I read on the "before you post" section that you might be willing to setup communication directly with a company to discuss solutions that would fit use cases. If it would be easier to do this, I would be happy to accommodate.

Thank you so much!
Reply all
Reply to author
Forward
0 new messages