AI-generated Key Takeaways
-
The
IMAStreamManagerDelegate
protocol provides callbacks for monitoring ad events, errors, and progress within theIMAStreamManager
. -
Developers can implement delegate methods to receive updates on ad playback, such as current time, duration, and position.
-
Error handling is facilitated through the
streamManager:didReceiveAdError:
method, providing insights into ad-related issues. -
Detailed ad information is available through callbacks, including ad break and period durations, along with the ad position within the break.
-
This protocol is essential for integrating and managing ad interactions within applications utilizing the Google Interactive Media Ads SDK.
IMAStreamManagerDelegate
@protocol IMAStreamManagerDelegate
A callback protocol for IMAStreamManager.
-
Called when there is an IMAAdEvent.
Declaration
Swift
func streamManager(_ streamManager: IMAStreamManager, didReceive event: IMAAdEvent)
Objective-C
- (void)streamManager:(nonnull IMAStreamManager *)streamManager didReceiveAdEvent:(nonnull IMAAdEvent *)event;
Parameters
streamManager
the IMAStreamManager receiving the event
event
the IMAAdEvent received
-
Called when there is an IMAAdEvent.
Declaration
Swift
func streamManager(_ streamManager: IMAStreamManager, didReceive error: IMAAdError)
Objective-C
- (void)streamManager:(nonnull IMAStreamManager *)streamManager didReceiveAdError:(nonnull IMAAdError *)error;
Parameters
streamManager
the IMAStreamManager receiving the error
error
the IMAAdError received
-
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.