Stay organized with collections
Save and categorize content based on your preferences.
This guide explains how to take action based on ad buffering state.
Using buffer events in your app
You can use the following delegate methods on IMAAdsManagerDelegate to add an
activity indicator to your app when ads pause to buffer:
- (void)adsManagerAdDidStartBuffering(IMAAdsManager *)adsManager: Called
when an ad that already started playing has stopped to buffer.
- (void)adsManager:(IMAAdsManager *)adsManager adDidBufferToMediaTime:(NSTimeInterval)mediaTime:
Called as an ad buffers. This method is called repeatedly as long as an ad is
buffering.
- (void)adsManagerAdPlaybackReady:(IMAAdsManager *)adsManager: Called when
the current ad is sufficiently buffered such that ad playback is not likely to
outrun the buffer.
@interfaceVideoViewController()<IMAAdsManagerDelegate,...>...@end@implementationVideoViewController...-(void)adsManagerAdDidStartBuffering:(IMAAdsManager*)adsManager{// Show your activity indicator above the video player - ad playback has// stopped to buffer.}-(void)adsManagerAdPlaybackReady:(IMAAdsManager*)adsManager{// Hide your activity indicator - as playback resumes.}
FAQ
Can I show an activity indicator before my ad starts playing?
Yes, but we recommend relying on different delegate methods for that
use case. You can show the activity indicator when you call [adsManager start],
and hide the activity indicator when you catch kIMAAdEvent_STARTED in
- (void)adsManager:(IMAAdsManager *)adsManager didReceiveAdEvent:(IMAAdEvent *)event.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-21 UTC."],[[["This guide provides instructions on how to leverage ad buffer events to display an activity indicator during ad buffering."],["Developers can utilize the `IMAAdsManagerDelegate` methods, such as `adsManagerAdDidStartBuffering`, `adsManager:adDidBufferToMediaTime:`, and `adsManagerAdPlaybackReady`, to manage the activity indicator's visibility based on the ad's buffering state."],["The provided code example demonstrates how to integrate these methods into an iOS or tvOS application, using the IMA SDK Advanced Sample as a basis."],["While displaying an activity indicator before ad playback is possible, it's recommended to use different delegate methods and events like `[adsManager start]` and `kIMAAdEvent_STARTED` for that purpose."]]],[]]