Skip to main content

Instream Video Ad Options

Ad Request Timeout

If no ad response is received within the specified time (seconds) after the ad request, the existing request is invalidated and the videoAdManager:didFailWithError:responseInfo: method of GFPVideoAdManager is called. (Default: 60 seconds)

self.videoAdManager?.requestTimeoutInterval = ...

GFPVideoAdRenderingSetting

You can configure video ad-related settings through GFPVideoAdRenderingSetting.

Settings can be configured via the renderingSetting property of GFPVideoAdManager and GFPVideoAdScheduleManager.

Values must be set before requesting an ad for them to take effect. See GFPVideoAdRenderingSetting.h for more details.

let renderingSetting = GFPVideoAdRenderingSetting()
renderingSetting.startTimeoutInterval = 5 // Playback start timeout: 5 seconds
renderingSetting.bufferingTimeoutInterval = 7 // Buffering timeout: 7 seconds
renderingSetting.bitrateKbps = 10 // Maximum bitrate of ad video: 10 Kbps
renderingSetting.preferredLanguage = .none // When set to none, the system language is used.
...

GFPVideoAdPlayerSetting

You can configure ad player-related settings through GFPVideoAdPlayerSetting.

Settings can be configured via the playerSetting property of GFPVideoAdManager and GFPVideoAdScheduleManager.

Values must be set before requesting an ad for them to take effect. See GFPVideoAdPlayerSetting.h for more details.

let playerSetting = GFPVideoAdPlayerSetting(action: .pause, audioSetting: .default)
self.videoAdManager?.playerSetting = playerSetting

GFPVideoBackgroundActionType

You can configure ad playback behavior when the app enters the background through GFPVideoBackgroundActionType.

  • GFPVideoBackgroundPause: Pause ad when entering the background
  • GFPVideoBackgroundPlay: Continue ad playback when entering the background
let playerSetting = GFPVideoAdPlayerSetting(action: .pause)
self.videoAdManager?.playerSetting = playerSetting

let playerSetting = GFPVideoAdPlayerSetting(action: .play)
self.videoAdManager?.playerSetting = playerSetting

GFPVideoAudioSettingType

You can configure behavior related to connecting or disconnecting headphones through GFPVideoAudioSettingType.

  • GFPVideoAudioSettingDefault: Follows AVPlayer default behavior. (AVPlayer pauses when headphones are disconnected)
  • GFPVideoAudioSettingAuto: Headphones disconnected: AVPlayer pauses. Headphones connected: AVPlayer plays.
let playerSetting = GFPVideoAdPlayerSetting(audioSetting: .default)
self.videoAdManager?.playerSetting = playerSetting

let playerSetting = GFPVideoAdPlayerSetting(audioSetting: .auto)
self.videoAdManager?.playerSetting = playerSetting

disableExternalPlayback

You can configure whether to allow external playback for ads through disableExternalPlayback.

  • NO: The ad player's allowExternalPlayback is set to true (default).
  • YES: The ad player's allowExternalPlayback is set to false.
let playerSetting = GFPVideoAdPlayerSetting(disableExternalPlayback: false)
self.videoAdManager?.playerSetting = playerSetting

let playerSetting = GFPVideoAdPlayerSetting(disableExternalPlayback: true)
self.videoAdManager?.playerSetting = playerSetting

Adjusting Volume

  • Can be set from 0 (muted) to 1 (loudest). Default volume is 1.
  • GFPVideoAdScheduleManager: Once set, the volume is used across sequential ads and pre-roll, mid-roll, and post-roll ads.
  • GFPVideoAdManager: Adjusts the volume for a single ad.
// 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 = 1

self.videoAdManager?.volume = 1

Ad Notice Display Duration

When setting the ad notice display duration for text such as "Plays after ad", the showNotice method of GFPVideoAdScheduleManagerDelegate is called noticeDurationSec seconds before the mid-roll ad plays.

scheduleParam.noticeDurationSec = 5.0

Controlling Ad UI Based on Content Player Component Visibility

See GFPVideoAdScheduleManager.h for more details.

Show the Ad Overlay (Seekbar, Pause, Resume, Election Ad, Post-Ad Text) Area

  • (void)showOverlayView;

Hide the Ad Overlay (Seekbar, Pause, Resume, Election Ad, Post-Ad Text) Area

  • (void)hideOverlayView;

Show RemindAd (Banner, Text)

  • (void)showRemindAd;

Hide RemindAd (Banner, Text)

  • (void)hideRemindAd;

Video Ad UI Mode Configuration

Set the displayMode according to the video mode of your service.

  • Normal Mode

Sample Image Sample Image

self.scheduleManager.displayMode = [GFPVideoDisplayMode normal];
  • PIP Mode

Sample Image Sample Image

self.scheduleManager.displayMode = [GFPVideoDisplayMode pip];

PIP-Specific Callbacks

Registering Callbacks

Register a pipDelegate that conforms to GFPVideoAdScheduleManagerPIPDelegate with the scheduleManager.

Close Button Tap Notification

The close button tap at the top is notified through scheduleManager:didTappedCloseBtnInPIP: of GFPVideoAdScheduleManagerPIPDelegate.

- (void)scheduleManager:(GFPVideoAdScheduleManager *)aScheduleAdManager didTappedCloseBtnInPIP:(GFPVideoAdBreakResult *)aResult {

}
Return Button Tap Notification

The return button tap at the top is notified through scheduleManager:didTappedReturnBtnInPIP: of GFPVideoAdScheduleManagerPIPDelegate.

- (void)scheduleManager:(GFPVideoAdScheduleManager *)aScheduleAdManager didTappedReturnBtnInPIP:(GFPVideoAdBreakResult *)aResult {

}

ControlView Callbacks

Registering Callbacks

Register a delegate that conforms to GFPVideoAdScheduleManagerDelegate with the scheduleManager.

Notification Before ControlView Is Shown

The start of the show animation for the control view is notified through scheduleManager:playControlWillShow: of GFPVideoAdScheduleManagerDelegate.

- (void)scheduleManager:(GFPVideoAdScheduleManager *)aScheduleAdManager playControlWillShow:(NSTimeInterval)duration {

}
Notification Before ControlView Is Hidden

The start of the hide animation for the control view is notified through scheduleManager:playControlHideShow: of GFPVideoAdScheduleManagerDelegate.

- (void)scheduleManager:(GFPVideoAdScheduleManager *)aScheduleAdManager playControlWillHide:(NSTimeInterval)duration {

}

Remind Text Ad Display for SMR and Custom Configuration

This customization is available through the GFPTextAdViewAttribute class.

let attribute = GFPTextAdViewAttribute(container: aContainer)
attribute.backgroundColor = UIColor.yellow
attribute.textColor = UIColor.red
attribute.verticalBarColor = UIColor.cyan
attribute.closeIcon = UIImage(named: "close")
attribute.moreIoon = UIImage(named: "more")
  • container
    • The container area for the Remind Text ad. (For portrait mode on the device; landscape mode is handled internally by the SDK.)
    • If nil, the Remind Text will not be displayed in portrait mode.
  • backgroundColor
    • Allows you to specify a background color other than the default background color for the Remind Text.
  • textColor
    • Allows you to specify a text color other than the default text color for the Remind Text.
  • verticalBarColor
    • Allows you to specify a vertical bar color other than the default vertical bar color for the Remind Text.
  • closeIcon
    • Allows you to specify a close icon other than the default close icon for the Remind Text.
  • moreIcon
    • Allows you to specify a more icon other than the default more icon for the Remind Text.

Changing the NonLinear Outer Container

You can pass an updated textAdViewAttribute through the replaceTextAdViewAttribute: method of GFPVideoAdScheduleManager.

func replace(_ textAdViewAttribute: GFPTextAdViewAttribute)