GoogleInteractiveMediaAds Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
IMAStreamManagerDelegate
@protocol IMAStreamManagerDelegate
A callback protocol for IMAStreamManager.
-
Called when there is an IMAAdEvent.
Parameters
streamManager
|
the IMAStreamManager receiving the event
|
event
|
|
-
Called when there is an IMAAdEvent.
Parameters
streamManager
|
the IMAStreamManager receiving the error
|
error
|
|
-
Called when the ad is playing to give updates about ad progress.
Declaration
Swift
optional func streamManager(_ streamManager: IMAStreamManager, adDidProgressToTime time: TimeInterval, adDuration: TimeInterval, adPosition: Int, totalAds: Int, adBreakDuration: TimeInterval, adPeriodDuration: TimeInterval)
Objective-C
- (void)streamManager:(nonnull IMAStreamManager *)streamManager
adDidProgressToTime:(NSTimeInterval)time
adDuration:(NSTimeInterval)adDuration
adPosition:(NSInteger)adPosition
totalAds:(NSInteger)totalAds
adBreakDuration:(NSTimeInterval)adBreakDuration
adPeriodDuration:(NSTimeInterval)adPeriodDuration;
Parameters
streamManager
|
the IMAStreamManager tracking ad playback
|
time
|
the current ad playback time in seconds
|
adDuration
|
the total duration of the current ad in seconds
|
adPosition
|
the ad position of the current ad in the current ad break
|
totalAds
|
the total number of ads in the current ad break
|
adBreakDuration
|
the total duration of the current ad break in seconds
|
adPeriodDuration
|
the total duration of the current ad period in seconds. This includes ads
duration plus slate.
|
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\u003eIMAStreamManagerDelegate is a callback protocol to receive updates and events from IMAStreamManager.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to handle ad events, ad errors, and ad progress updates during ad playback.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003estreamManager:didReceiveAdEvent:\u003c/code\u003e is called when an IMAAdEvent occurs, delivering information about ad lifecycle events.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003estreamManager:didReceiveAdError:\u003c/code\u003e is called when an IMAAdError is encountered, providing details about the error.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003estreamManager:adDidProgressToTime:adDuration:adPosition:totalAds:adBreakDuration:adPeriodDuration:\u003c/code\u003e is called periodically during ad playback, providing updates about the current ad's progress, duration, and position within the ad break and ad period.\u003c/p\u003e\n"]]],[],null,["# GoogleInteractiveMediaAds Framework Reference\n\nIMAStreamManagerDelegate\n========================\n\n @protocol IMAStreamManagerDelegate\n\nA callback protocol for IMAStreamManager.\n- `\n ``\n ``\n `\n\n ### [-streamManager:didReceiveAdEvent:](#/c:objc(pl)IMAStreamManagerDelegate(im)streamManager:didReceiveAdEvent:)\n\n `\n ` \n Called when there is an IMAAdEvent. \n\n #### Declaration\n\n Swift \n\n func streamManager(_ streamManager: ../Classes/IMAStreamManager.html, didReceive event: ../Classes/IMAAdEvent.html)\n\n Objective-C \n\n - (void)streamManager:(nonnull ../Classes/IMAStreamManager.html *)streamManager\n didReceiveAdEvent:(nonnull ../Classes/IMAAdEvent.html *)event;\n\n #### Parameters\n\n |-----------------------|------------------------------------------|\n | ` `*streamManager*` ` | the IMAStreamManager receiving the event |\n | ` `*event*` ` | the IMAAdEvent received |\n\n- `\n ``\n ``\n `\n\n ### [-streamManager:didReceiveAdError:](#/c:objc(pl)IMAStreamManagerDelegate(im)streamManager:didReceiveAdError:)\n\n `\n ` \n Called when there is an IMAAdEvent. \n\n #### Declaration\n\n Swift \n\n func streamManager(_ streamManager: ../Classes/IMAStreamManager.html, didReceive error: ../Classes/IMAAdError.html)\n\n Objective-C \n\n - (void)streamManager:(nonnull ../Classes/IMAStreamManager.html *)streamManager\n didReceiveAdError:(nonnull ../Classes/IMAAdError.html *)error;\n\n #### Parameters\n\n |-----------------------|------------------------------------------|\n | ` `*streamManager*` ` | the IMAStreamManager receiving the error |\n | ` `*error*` ` | the IMAAdError received |\n\n- `\n ``\n ``\n `\n\n ### [-streamManager:adDidProgressToTime:adDuration:adPosition:totalAds:adBreakDuration:adPeriodDuration:](#/c:objc(pl)IMAStreamManagerDelegate(im)streamManager:adDidProgressToTime:adDuration:adPosition:totalAds:adBreakDuration:adPeriodDuration:)\n\n `\n ` \n Called when the ad is playing to give updates about ad progress. \n\n #### Declaration\n\n Swift \n\n optional func streamManager(_ streamManager: ../Classes/IMAStreamManager.html, adDidProgressToTime time: TimeInterval, adDuration: TimeInterval, adPosition: Int, totalAds: Int, adBreakDuration: TimeInterval, adPeriodDuration: TimeInterval)\n\n Objective-C \n\n - (void)streamManager:(nonnull ../Classes/IMAStreamManager.html *)streamManager\n adDidProgressToTime:(NSTimeInterval)time\n adDuration:(NSTimeInterval)adDuration\n adPosition:(NSInteger)adPosition\n totalAds:(NSInteger)totalAds\n adBreakDuration:(NSTimeInterval)adBreakDuration\n adPeriodDuration:(NSTimeInterval)adPeriodDuration;\n\n #### Parameters\n\n |--------------------------|------------------------------------------------------------------------------------------------|\n | ` `*streamManager*` ` | the IMAStreamManager tracking ad playback |\n | ` `*time*` ` | the current ad playback time in seconds |\n | ` `*adDuration*` ` | the total duration of the current ad in seconds |\n | ` `*adPosition*` ` | the ad position of the current ad in the current ad break |\n | ` `*totalAds*` ` | the total number of ads in the current ad break |\n | ` `*adBreakDuration*` ` | the total duration of the current ad break in seconds |\n | ` `*adPeriodDuration*` ` | the total duration of the current ad period in seconds. This includes ads duration plus slate. |"]]