Skip to main content

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

// GFPAdConfiguration.h

@property (nonatomic, assign) BOOL useLoudness;

[GFPAdManager adConfiguration].useLoudness = YES;

GFPVideoAdRenderingSetting

Configure GFPVideoAdRenderingSetting before requesting ad, in either GFPVideoAdManager or GFPVideoAdScheduleManager See more information in GFPVideoAdRenderingSetting.h.

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
...

GFPVideoAdPlayerSetting

Configure GFPVideoAdPlayerSetting for various video player settings,in either GFPVideoAdManagerGFPVideoAdScheduleManager See more information in GFPVideoAdPlayerSetting.h

GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithAction: GFPVideoBackgroundPause audioSetting: GFPVideoAudioSettingDefault];
self.videoAdManager.playerSetting = playerSetting;

GFPVideoBackgroundActionType

Configure GFPVideoBackgroundActionType for video's action when the app goes background.

  • GFPVideoBackgroundPause : pause in background
  • GFPVideoBackgroundPlay : continue in background
GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithAction: GFPVideoBackgroundPause];
self.videoAdManager.playerSetting = playerSetting;

GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithAction: GFPVideoBackgroundPlay];
self.videoAdManager.playerSetting = playerSetting;

GFPVideoAudioSettingType

Configure GFPVideoAudioSettingType for video's actions when headphones are connected or disconnected.

  • GFPVideoAudioSettingDefault: AVPlayer Default pause when headphones are disconnected
  • GFPVideoAudioSettingAuto: Plays when headphones are connected. Pauses when headphones are disconnected
GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithAudioSetting: GFPVideoAudioSettingDefault];
self.videoAdManager.playerSetting = playerSetting;

GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithAudioSetting: GFPVideoAudioSettingAuto];
self.videoAdManager.playerSetting = playerSetting;

disableExternalPlayback

Configure disableExternalPlayback to allow or disallow external playbacks. Default is YES

See more information on AVPlayer allowsExternalPlayback

GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithDisableExternalPlayback: NO];
self.videoAdManager.playerSetting = playerSetting;

GFPVideoAdPlayerSetting *playerSetting = [[GFPVideoAdPlayerSetting alloc] initWithDisableExternalPlayback: YES];
self.videoAdManager.playerSetting = playerSetting;

Adjusting Sound Level

  • Set volume from [0, Muted] to [1, Loudest]
  • volume on GFPVideoAdScheduleManager applies to all of its scheduled videos.
  • volume on GFPVideoAdManager applies to single video that it manages.
// 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.
// 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