GoogleInteractiveMediaAds Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
IMAAdsManagerDelegate
@protocol IMAAdsManagerDelegate
A callback protocol for IMAAdsManager.
-
Called when there is an IMAAdEvent.
Parameters
adsManager
|
the IMAAdsManager receiving the event
|
event
|
|
-
Called when there was an error playing the ad.
Log the error and resume playing content.
Parameters
adsManager
|
the IMAAdsManager that errored
|
error
|
|
-
Called when an ad is ready to play.
The implementing code should pause the content playback and prepare the UI
for ad playback.
Declaration
Swift
func adsManagerDidRequestContentPause(_ adsManager: IMAAdsManager)
Objective-C
- (void)adsManagerDidRequestContentPause:(nonnull IMAAdsManager *)adsManager;
Parameters
adsManager
|
the IMAAdsManager requesting content pause
|
-
Called when an ad has finished or an error occurred during the playback.
The implementing code should resume the content playback.
Declaration
Swift
func adsManagerDidRequestContentResume(_ adsManager: IMAAdsManager)
Objective-C
- (void)adsManagerDidRequestContentResume:(nonnull IMAAdsManager *)adsManager;
Parameters
adsManager
|
the IMAAdsManager requesting content resume
|
-
Called every 200ms to provide time updates for the current ad.
Declaration
Swift
optional func adsManager(_ adsManager: IMAAdsManager, adDidProgressToTime mediaTime: TimeInterval, totalTime: TimeInterval)
Objective-C
- (void)adsManager:(nonnull IMAAdsManager *)adsManager
adDidProgressToTime:(NSTimeInterval)mediaTime
totalTime:(NSTimeInterval)totalTime;
Parameters
adsManager
|
the IMAAdsManager tracking ad playback
|
mediaTime
|
the current media time in seconds
|
totalTime
|
the total media length in seconds
|
-
Called when the current ad is sufficiently buffered and playback is likely
to keep up.
Declaration
Swift
optional func adsManagerAdPlaybackReady(_ adsManager: IMAAdsManager)
Objective-C
- (void)adsManagerAdPlaybackReady:(nonnull IMAAdsManager *)adsManager;
Parameters
adsManager
|
the IMAAdsManager with ad playback ready
|
-
Called when the current ad media buffer is empty and playback did stall.
Declaration
Swift
optional func adsManagerAdDidStartBuffering(_ adsManager: IMAAdsManager)
Objective-C
- (void)adsManagerAdDidStartBuffering:(nonnull IMAAdsManager *)adsManager;
Parameters
adsManager
|
the IMAAdsManager tracking the stalled ad
|
-
Called as the current ad media buffers.
Declaration
Swift
optional func adsManager(_ adsManager: IMAAdsManager, adDidBufferToMediaTime mediaTime: TimeInterval)
Objective-C
- (void)adsManager:(nonnull IMAAdsManager *)adsManager
adDidBufferToMediaTime:(NSTimeInterval)mediaTime;
Parameters
adsManager
|
the IMAAdsManager tracking the ad’s media buffer
|
mediaTime
|
the current buffered media time in seconds
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[null,null,["Last updated 2025-08-20 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eIMAAdsManagerDelegate\u003c/code\u003e protocol handles ad events, errors, and playback states in the IMA SDK.\u003c/p\u003e\n"],["\u003cp\u003eIt provides callbacks for ad progress, content pause/resume requests, and ad buffering events.\u003c/p\u003e\n"],["\u003cp\u003eDelegates receive information about ad playback through methods like \u003ccode\u003eadsManager:didReceiveAdEvent:\u003c/code\u003e and \u003ccode\u003eadsManager:didReceiveAdError:\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eContent playback can be managed through the \u003ccode\u003eadsManagerDidRequestContentPause:\u003c/code\u003e and \u003ccode\u003eadsManagerDidRequestContentResume:\u003c/code\u003e methods.\u003c/p\u003e\n"],["\u003cp\u003eThe delegate also offers optional methods to track ad buffering and progress updates.\u003c/p\u003e\n"]]],["The `IMAAdsManagerDelegate` protocol provides callbacks for managing ad playback. Key actions include: receiving ad events and errors, pausing and resuming content when ads play, tracking ad progress with time updates (every 200ms), signaling when an ad is ready for playback, start buffering, and the buffered media time. The protocol also handles content pausing and resuming requests from the `IMAAdsManager`, allowing the implementation to prepare the UI for ad playback.\n"],null,["# GoogleInteractiveMediaAds Framework Reference\n\nIMAAdsManagerDelegate\n=====================\n\n @protocol IMAAdsManagerDelegate\n\nA callback protocol for IMAAdsManager.\n- `\n ``\n ``\n `\n\n ### [-adsManager:didReceiveAdEvent:](#/c:objc(pl)IMAAdsManagerDelegate(im)adsManager:didReceiveAdEvent:)\n\n `\n ` \n Called when there is an IMAAdEvent. \n\n #### Declaration\n\n Swift \n\n func adsManager(_ adsManager: ../Classes/IMAAdsManager.html, didReceive event: ../Classes/IMAAdEvent.html)\n\n Objective-C \n\n - (void)adsManager:(nonnull ../Classes/IMAAdsManager.html *)adsManager\n didReceiveAdEvent:(nonnull ../Classes/IMAAdEvent.html *)event;\n\n #### Parameters\n\n |--------------------|---------------------------------------|\n | ` `*adsManager*` ` | the IMAAdsManager receiving the event |\n | ` `*event*` ` | the IMAAdEvent received |\n\n- `\n ``\n ``\n `\n\n ### [-adsManager:didReceiveAdError:](#/c:objc(pl)IMAAdsManagerDelegate(im)adsManager:didReceiveAdError:)\n\n `\n ` \n Called when there was an error playing the ad.\n Log the error and resume playing content. \n\n #### Declaration\n\n Swift \n\n func adsManager(_ adsManager: ../Classes/IMAAdsManager.html, didReceive error: ../Classes/IMAAdError.html)\n\n Objective-C \n\n - (void)adsManager:(nonnull ../Classes/IMAAdsManager.html *)adsManager\n didReceiveAdError:(nonnull ../Classes/IMAAdError.html *)error;\n\n #### Parameters\n\n |--------------------|--------------------------------|\n | ` `*adsManager*` ` | the IMAAdsManager that errored |\n | ` `*error*` ` | the IMAAdError received |\n\n- `\n ``\n ``\n `\n\n ### [-adsManagerDidRequestContentPause:](#/c:objc(pl)IMAAdsManagerDelegate(im)adsManagerDidRequestContentPause:)\n\n `\n ` \n Called when an ad is ready to play.\n The implementing code should pause the content playback and prepare the UI\n for ad playback. \n\n #### Declaration\n\n Swift \n\n func adsManagerDidRequestContentPause(_ adsManager: ../Classes/IMAAdsManager.html)\n\n Objective-C \n\n - (void)adsManagerDidRequestContentPause:(nonnull ../Classes/IMAAdsManager.html *)adsManager;\n\n #### Parameters\n\n |--------------------|--------------------------------------------|\n | ` `*adsManager*` ` | the IMAAdsManager requesting content pause |\n\n- `\n ``\n ``\n `\n\n ### [-adsManagerDidRequestContentResume:](#/c:objc(pl)IMAAdsManagerDelegate(im)adsManagerDidRequestContentResume:)\n\n `\n ` \n Called when an ad has finished or an error occurred during the playback.\n The implementing code should resume the content playback. \n\n #### Declaration\n\n Swift \n\n func adsManagerDidRequestContentResume(_ adsManager: ../Classes/IMAAdsManager.html)\n\n Objective-C \n\n - (void)adsManagerDidRequestContentResume:(nonnull ../Classes/IMAAdsManager.html *)adsManager;\n\n #### Parameters\n\n |--------------------|---------------------------------------------|\n | ` `*adsManager*` ` | the IMAAdsManager requesting content resume |\n\n- `\n ``\n ``\n `\n\n ### [-adsManager:adDidProgressToTime:totalTime:](#/c:objc(pl)IMAAdsManagerDelegate(im)adsManager:adDidProgressToTime:totalTime:)\n\n `\n ` \n Called every 200ms to provide time updates for the current ad. \n\n #### Declaration\n\n Swift \n\n optional func adsManager(_ adsManager: ../Classes/IMAAdsManager.html, adDidProgressToTime mediaTime: TimeInterval, totalTime: TimeInterval)\n\n Objective-C \n\n - (void)adsManager:(nonnull ../Classes/IMAAdsManager.html *)adsManager\n adDidProgressToTime:(NSTimeInterval)mediaTime\n totalTime:(NSTimeInterval)totalTime;\n\n #### Parameters\n\n |--------------------|----------------------------------------|\n | ` `*adsManager*` ` | the IMAAdsManager tracking ad playback |\n | ` `*mediaTime*` ` | the current media time in seconds |\n | ` `*totalTime*` ` | the total media length in seconds |\n\n- `\n ``\n ``\n `\n\n ### [-adsManagerAdPlaybackReady:](#/c:objc(pl)IMAAdsManagerDelegate(im)adsManagerAdPlaybackReady:)\n\n `\n ` \n Called when the current ad is sufficiently buffered and playback is likely\n to keep up. \n\n #### Declaration\n\n Swift \n\n optional func adsManagerAdPlaybackReady(_ adsManager: ../Classes/IMAAdsManager.html)\n\n Objective-C \n\n - (void)adsManagerAdPlaybackReady:(nonnull ../Classes/IMAAdsManager.html *)adsManager;\n\n #### Parameters\n\n |--------------------|------------------------------------------|\n | ` `*adsManager*` ` | the IMAAdsManager with ad playback ready |\n\n- `\n ``\n ``\n `\n\n ### [-adsManagerAdDidStartBuffering:](#/c:objc(pl)IMAAdsManagerDelegate(im)adsManagerAdDidStartBuffering:)\n\n `\n ` \n Called when the current ad media buffer is empty and playback did stall. \n\n #### Declaration\n\n Swift \n\n optional func adsManagerAdDidStartBuffering(_ adsManager: ../Classes/IMAAdsManager.html)\n\n Objective-C \n\n - (void)adsManagerAdDidStartBuffering:(nonnull ../Classes/IMAAdsManager.html *)adsManager;\n\n #### Parameters\n\n |--------------------|-------------------------------------------|\n | ` `*adsManager*` ` | the IMAAdsManager tracking the stalled ad |\n\n- `\n ``\n ``\n `\n\n ### [-adsManager:adDidBufferToMediaTime:](#/c:objc(pl)IMAAdsManagerDelegate(im)adsManager:adDidBufferToMediaTime:)\n\n `\n ` \n Called as the current ad media buffers. \n\n #### Declaration\n\n Swift \n\n optional func adsManager(_ adsManager: ../Classes/IMAAdsManager.html, adDidBufferToMediaTime mediaTime: TimeInterval)\n\n Objective-C \n\n - (void)adsManager:(nonnull ../Classes/IMAAdsManager.html *)adsManager\n adDidBufferToMediaTime:(NSTimeInterval)mediaTime;\n\n #### Parameters\n\n |--------------------|--------------------------------------------------|\n | ` `*adsManager*` ` | the IMAAdsManager tracking the ad's media buffer |\n | ` `*mediaTime*` ` | the current buffered media time in seconds |"]]