Video Ads - Common
Video Ad Managers
There are two types of video ad managers.
- GFPVideoAdManager, for pre-stream ad.
- [GFPVideoAdScheduleManager](mid.mdx/post stream video
Common Configurations
Automated Loudness
Use GFPAdConfiguration.useLoudness to automatically level audio volume. Default is NO
- Objective-C
- Swift
// GFPAdConfiguration.h
@property (nonatomic, assign) BOOL useLoudness;
[GFPAdManager adConfiguration].useLoudness = YES;
// GFPAdConfiguration.h
@property (nonatomic, assign) BOOL useLoudness;
GFPAdManager.adConfiguration().useLoudness = true
GFPVideoAdRenderingSetting
Configure GFPVideoAdRenderingSetting before requesting ad, in either GFPVideoAdManager or GFPVideoAdScheduleManager See more information in GFPVideoAdRenderingSetting.h.
- Objective-C
- Swift
GFPVideoAdRenderingSetting *renderingSetting = [[GFPVideoAdRenderingSetting alloc] init];
renderingSetting.startTimeoutInterval = 5; // Video start timeout
renderingSetting.bufferingTimeoutInterval = 7; // Video Buffering timeout
renderingSetting.bitrateKbps = 10; // Maximum bitrate
renderingSetting.preferredLanguage = GFPLanguageType_none; // "none" sets to device language
...
let renderingSetting = GFPVideoAdRenderingSetting()
renderingSetting.startTimeoutInterval = 5 // Video start timeout
renderingSetting.bufferingTimeoutInterval = 7 // Video Buffering timeout
renderingSetting.bitrateKbps = 10 // Maximum bitrate
renderingSetting.preferredLanguage = .none // "none" sets to device language
...
GFPVideoAdPlayerSetting
Configure GFPVideoAdPlayerSetting for various video player settings,in either GFPVideoAdManager와 GFPVideoAdScheduleManager See more information in GFPVideoAdPlayerSetting.h
- Objective-C
- Swift
GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithAction: GFPVideoBackgroundPause audioSetting: GFPVideoAudioSettingDefault];
self.videoAdManager.playerSetting = playerSetting;
let playerSetting = GFPVideoAdPlayerSetting(action: .pause, audioSetting: .default)
self.videoAdManager?.playerSetting = playerSetting
GFPVideoBackgroundActionType
Configure GFPVideoBackgroundActionType for video's action when the app goes background.
- GFPVideoBackgroundPause : pause in background
- GFPVideoBackgroundPlay : continue in background
- Objective-C
- Swift
GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithAction: GFPVideoBackgroundPause];
self.videoAdManager.playerSetting = playerSetting;
GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithAction: GFPVideoBackgroundPlay];
self.videoAdManager.playerSetting = playerSetting;
let playerSetting = GFPVideoAdPlayerSetting(action: .pause)
self.videoAdManager?.playerSetting = playerSetting
let playerSetting = GFPVideoAdPlayerSetting(action: .play)
self.videoAdManager?.playerSetting = playerSetting
GFPVideoAudioSettingType
Configure GFPVideoAudioSettingType for video's actions when headphones are connected or disconnected.
GFPVideoAudioSettingDefault
: AVPlayer Default pause when headphones are disconnectedGFPVideoAudioSettingAuto
: Plays when headphones are connected. Pauses when headphones are disconnected
- Objective-C
- Swift
GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithAudioSetting: GFPVideoAudioSettingDefault];
self.videoAdManager.playerSetting = playerSetting;
GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithAudioSetting: GFPVideoAudioSettingAuto];
self.videoAdManager.playerSetting = playerSetting;
let playerSetting = GFPVideoAdPlayerSetting(audioSetting: .default)
self.videoAdManager?.playerSetting = playerSetting
let playerSetting = GFPVideoAdPlayerSetting(audioSetting: .auto)
self.videoAdManager?.playerSetting = playerSetting
disableExternalPlayback
Configure disableExternalPlayback
to allow or disallow external playbacks. Default is YES
See more information on AVPlayer allowsExternalPlayback
- Objective-C
- Swift
GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithDisableExternalPlayback: NO];
self.videoAdManager.playerSetting = playerSetting;
GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithDisableExternalPlayback: YES];
self.videoAdManager.playerSetting = playerSetting;
let playerSetting = GFPVideoAdPlayerSetting(disableExternalPlayback: false)
self.videoAdManager?.playerSetting = playerSetting
let playerSetting = GFPVideoAdPlayerSetting(disableExternalPlayback: true)
self.videoAdManager?.playerSetting = playerSetting
Adjusting Sound Level
- Set
volume
from [0, Muted] to [1, Loudest] volume
onGFPVideoAdScheduleManager
applies to all of its scheduled videos.volume
onGFPVideoAdManager
applies to single video that it manages.
- Objective-C
- Swift
// GFPVideoAdScheduleManager.h
@interface GFPVideoAdScheduleManager : NSObject
@property (nonatomic, assign) float volume;
@end
// GFPVideoAdManager.h
@interface GFPVideoAdManager : NSObject
@property (readwrite, nonatomic, assign) float volume;
@end
//Example
self.scheduleManager.volume = 15;
self.videoAdManager.volume = 15;
// GFPVideoAdScheduleManager.h
@interface GFPVideoAdScheduleManager : NSObject
@property (nonatomic, assign) float volume;
@end
// GFPVideoAdManager.h
@interface GFPVideoAdManager : NSObject
@property (readwrite, nonatomic, assign) float volume;
@end
//Example
self.scheduleManager?.volume = 15
self.videoAdManager?.volume = 15
Google IMA Video Ad Play Condition
- For IMA >= 3.12.1 (GFPSDK >= 2.2.4), it is necessary to set the root view controller for the video ad manangers.
- Objective-C
- Swift
// GFPVideoAdScheduleManager.h
@interface GFPVideoAdScheduleManager : NSObject
@property (nonatomic, weak, nullable) UIViewController *rootViewController;
@end
// GFPVideoAdManager.h
@interface GFPVideoAdManager : NSObject
@property (nonatomic, weak, nullable) UIViewController *rootViewController;
@end
//Example
self.scheduleManager.rootViewController = self
self.videoAdManager.rootViewController = self
// GFPVideoAdScheduleManager.h
@interface GFPVideoAdScheduleManager : NSObject
@property (nonatomic, weak, nullable) UIViewController *rootViewController;
@end
// GFPVideoAdManager.h
@interface GFPVideoAdManager : NSObject
@property (nonatomic, weak, nullable) UIViewController *rootViewController;
@end
//Example
self.scheduleManager?.rootViewController = self
self.videoAdManager?.rootViewController = self
Auxiliary
Quality of Experience(QOE)
Implement GFPVideoAdManager.qoeDelegate
and GFPVideoAdScheduleManager.qoeDelegate
to get more detailed informations about video playback.
See More information on GFPVideoAdQoeDelegate.h
and GFPVideoAdQoeInfo.h