Slow playing of Ima Ads on android

172 views
Skip to first unread message

Mohit Sharma

unread,
May 12, 2021, 1:56:25 AM5/12/21
to Interactive Media Ads SDK
We are using a custom implementation of IMA ad SDK in our android app. 
We are starting ads only after we get AdEvent.AdEventType.LOADED  callback from adManager. We are seeing that playAd is getting called immediately, but the ad video is taking 3-5 seconds time before the first frame of the ad is visible.

Please let us know, what could be the potential reason for this or any solution that we can try? 

We are using the below version of IMA SDK and playing an ad in VideoView as it is done in AdvanceExample of ImaAd documentation. 

com.google.ads.interactivemedia.v3:interactivemedia:3.21.4 

IMA SDK

unread,
May 12, 2021, 5:43:18 AM5/12/21
to ima...@googlegroups.com

Hi there,

 

Thank you for reaching out to us regarding your concern. Upon testing, I do not see the same behavior you are reporting. Can you please confirm where do you log this playAd you mentioned to know if the ad already started? AdEvent.AdEventType LOADED only tells you that the VAST response has been received, but you should wait for the AdEvent.AdEventType STARTED to be fired to see that the ad started to actually play.

 

I also notice that you are using an earlier version of the SDK, can you please update to our latest release as it might affect performance issue, and see if this behavior is still reproducible on our sample apps.

Regards,

Google Logo
Michael Angelo Legaspi
IMA SDK Team
 


ref:_00D1U1174p._5004Q2HAFCo:ref

Mohit Sharma

unread,
May 12, 2021, 6:43:12 AM5/12/21
to Interactive Media Ads SDK
Hello Team, 

We are also using enablePreloading = true white initializing adManager. Below are the logs for adManager events.  

2021-05-12 14:47:01.561 20295-20295/in.mohalla.sharechat E/ImaVideoPlayer: onAdEvent: LOADED
2021-05-12 14:47:01.569 20295-20295/in.mohalla.sharechat E/ImaVideoPlayer: loadAd: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo@1493703 
2021-05-12 14:47:06.601 20295-20295/in.mohalla.sharechat E/ImaVideoPlayer: onAdEvent: CONTENT_PAUSE_REQUESTED
2021-05-12 14:47:06.711 20295-20295/in.mohalla.sharechat E/ImaVideoPlayer: playAd: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo@1493703
2021-05-12 14:47:08.975 20295-20295/in.mohalla.sharechat E/ImaVideoPlayer: onAdEvent: STARTED
2021-05-12 14:47:08.982 20295-20295/in.mohalla.sharechat E/ImaVideoPlayer: onAdEvent: AdEvent[type=AD_PROGRESS, ...]

As we can see from the above logs, the time between playAd and STARTED event is 2seconds+ time. We hide the video content UI and show the ad UI on CONTENT_PAUSE_REQUESTED event. 
Our users are seeing the black screen in those 2 seconds(sometimes it take around 5 seconds). 

We also tried to switch UI after STARTED event, but that is not working. We are getting a Vast 402 error in that case. 

Is there anything that we could do about this? 


IMA SDK

unread,
May 12, 2021, 10:10:30 AM5/12/21
to ima...@googlegroups.com
Hi Mohit,

I work with Michel and will assist you. Thank you for that important detail about preloading, we have Supporting preloading with a custom VideoAdPlayer. Feel free to get back to us if this doesn't help.

Regards,

Google Logo
Aryeh Baker
IMA SDK Team
 


ref:_00D1U1174p._5004Q2HAFCo:ref

Mohit Sharma

unread,
May 13, 2021, 6:04:47 AM5/13/21
to Interactive Media Ads SDK
Hello Aryeh, 

We have tried the preloading implementation for the custom videoAdPlayer as shown in the documentation shared by you. 
Posting the code snippets of the changes that were required to support preloading functionality. 
Screenshot 2021-05-13 at 3.18.56 PM.png


Screenshot 2021-05-13 at 3.20.54 PM.png

Screenshot 2021-05-13 at 3.21.46 PM.png

From the documentation and implementation that was given for preLoading, I am assuming that loadAd, playAd methods will be called multiple times. Please let me know if my understanding is correct,
and the way we have implemented our code is correct or not, especially stopAd method. Because in the documentation below implementation is given, but I didn't understand correctly what last 3 empty functions should exactly do. 
Screenshot 2021-05-13 at 3.27.09 PM.png

I am pasting the logs that we have got by using the above-shared implementation. 

2021-05-13 15:10:07.681 30515-30515/? E/ImaVideoPlayer: prepareAdManager: enablePreLogin: true
2021-05-13 15:10:07.720 30515-30515/? E/ImaVideoPlayer: onAdEvent: LOADED
2021-05-13 15:10:07.729 30515-30515/? E/ImaVideoPlayer: loadAd: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo@85ac9c3 
2021-05-13 15:10:12.765 30515-30515/? E/ImaVideoPlayer: onAdEvent: CONTENT_PAUSE_REQUESTED
2021-05-13 15:10:12.997 30515-30515/? E/ImaVideoPlayer: playAd: com.google.ads.interactivemedia.v3.api.player.AdMediaInfo@85ac9c3 
2021-05-13 15:10:15.619 30515-30515/? E/ImaVideoPlayer: onAdEvent: STARTED
2021-05-13 15:10:15.636 30515-30515/? E/ImaVideoPlayer: onAdEvent: AdEvent[type=AD_PROGRESS, ...]


Also, we don't see any other log of loadAd or playAd, which means they are only called once. Are we missing something here? We had the assumption that they will be called multiple times and the ad would load faster. 
But from the logs, we can see that the ad is taking 2.5seconds to show the first frame of the ad. 

Thanks & Regards,
Mohit

IMA SDK

unread,
May 13, 2021, 2:58:27 PM5/13/21
to ima...@googlegroups.com
Hi Mohit,

Preloading doesn't help for prerolls. Preloading occurs when there's time while content or an ad is playing to load the mediaFile of the ad a few seconds before playing it. 

To test your ad tag you can try it on The Basic Example that has out of the box preloading. If the same behavior occurs there, then the ad tag itself is at fault. You can also try our sample ad tags. If the ad tag works correctly in the Basic Example, could you send us your implementation and we can work from there.

You can send us privately the ad tag or the project for us to test. Alternatively, you may send it via our testing alias imate...@gmail.com with a post on this thread once you have done so. 

Mohit Sharma

unread,
May 13, 2021, 3:35:10 PM5/13/21
to Interactive Media Ads SDK
Hello Team,

If you will see in the logs, there is 5second time between onAdEvent: LOADED and onAdEvent: CONTENT_PAUSE_REQUESTED. 
We show the user a timer of 5seconds before calling adManager.start(). Is 5 seconds time not enough to preload the media file? we can give more time if required.
We are also using the Ima Sample tag on ima documentation. We are observing the same behavior in that as well. 

IMA SDK

unread,
May 13, 2021, 4:06:23 PM5/13/21
to ima...@googlegroups.com
Hi Mohit,

Could you send us a bare bones project with your implementation?

Mohit Sharma

unread,
May 13, 2021, 4:08:08 PM5/13/21
to Interactive Media Ads SDK
Please provide me an email id to send. 

IMA SDK

unread,
May 13, 2021, 4:10:11 PM5/13/21
to ima...@googlegroups.com
Hi Mohit,


you may send it via our testing alias imate...@gmail.com with a post on this thread once you have done so. 

Mohit Sharma

unread,
May 14, 2021, 8:21:45 AM5/14/21
to Interactive Media Ads SDK
Hello Team,

This issue is fixed. What we observed, is that loadAd call is getting called early when we set preLoading flag to true. 
But we were using VideoView of android, which was not able to preload the media file. When we replaced it with ExoPlayer, the issue was fixed as exoplayer was preloading the media file. 

Thank you for your helping guys. 

Thanks & Regards,
Mohit

IMA SDK

unread,
May 14, 2021, 10:34:19 AM5/14/21
to ima...@googlegroups.com
Hi Mohit,

Thank you for reporting your experience with VideoView not being able to preload a media file and that Exoplayer worked out. There is an IMA SDK plugin for Exoplayer that our Basic Example uses which supports preloading out of the box.
Reply all
Reply to author
Forward
0 new messages