AI-generated Key Takeaways
-
GADAudioVideoManagerDelegate
informs the app about audio and video events related to Google Mobile Ads. -
It notifies the app when a video starts or pauses, enabling the app to manage audio playback accordingly.
-
The delegate helps synchronize the app's audio with Google Mobile Ads videos, preventing conflicts and ensuring a seamless user experience.
-
It provides signals for managing audio sessions based on the Google Mobile Ads video playback state, allowing apps to control sound seamlessly.
-
Apps can utilize this delegate to pause their own audio when an ad starts playing and resume when the ad finishes or pauses.
GADAudioVideoManagerDelegate
@protocol GADAudioVideoManagerDelegate <NSObject>
A set of methods to inform the delegate of audio video manager events.
-
Tells the delegate that the Google Mobile Ads SDK will start playing a video. This method isn’t called if another video rendered by Google Mobile Ads SDK is already playing.
Declaration
Swift
optional func audioVideoManagerWillPlayVideo(_ audioVideoManager: GADAudioVideoManager)
Objective-C
- (void)audioVideoManagerWillPlayVideo: (nonnull GADAudioVideoManager *)audioVideoManager;
-
Tells the delegate that the Google Mobile Ads SDK has paused/stopped all video playback.
Declaration
Swift
optional func audioVideoManagerDidPauseAllVideo(_ audioVideoManager: GADAudioVideoManager)
Objective-C
- (void)audioVideoManagerDidPauseAllVideo: (nonnull GADAudioVideoManager *)audioVideoManager;
-
Tells the delegate that at least one video rendered by the Google Mobile Ads SDK will play sound. Your app should stop playing sound when this method is called.
Declaration
Swift
optional func audioVideoManagerWillPlayAudio(_ audioVideoManager: GADAudioVideoManager)
Objective-C
- (void)audioVideoManagerWillPlayAudio: (nonnull GADAudioVideoManager *)audioVideoManager;
-
Tells the delegate that all the video rendered by the Google Mobile Ads SDK has stopped playing sound. Your app can now resume any music playback or produce any kind of sound. Note that this message doesn’t mean that all the video has stopped playing, just audio, so you shouldn’t deactivate AVAudioSession’s instance. Doing so can lead to unexpected video playback behavior. You may deactivate AVAudioSession only when all rendered video ads are paused or have finished playing, and ‘audioVideoDidPauseAllVideo:’ is called.
Declaration
Swift
optional func audioVideoManagerDidStopPlayingAudio(_ audioVideoManager: GADAudioVideoManager)
Objective-C
- (void)audioVideoManagerDidStopPlayingAudio: (nonnull GADAudioVideoManager *)audioVideoManager;