Ad Policy
Ad policies are rule sets that can be enforced while handling seek events with media containing adverts. The following are the rules and behaviours defined.
PlaybackFastForwardRule
Ad playback policy applicable with fast forward operation.
Rule | Description |
---|---|
TRICK_FW_PLAY_ALL | It enforces the rule that the player will replay all the ad breaks that were leaped over by the user during trick mode fast forward operation. This is the default rule. |
TRICK_FW_PLAY_FIRST | It enforces the rule that the player will replay only the first ad break that was leaped over by the user during trick mode fast forward operation. |
TRICK_FW_PLAY_LAST | It enforces the rule that the player will replay only the last ad break that was leaped over by the user during trick mode fast forward operation. |
TRICK_FW_SKIP_ALL | It enforces the rule that the player will skip all the ad breaks that were leaped over by the user during trick mode fast forward operation. |
PlaybackRewindRule
Ad playback policy applicable with rewind operation.
Rule | Description |
---|---|
TRICK_RW_PLAY_ALL | It enforces the rule that the player will replay all the ad breaks that were leaped over by the user during trick mode rewind operation. This is the default rule. |
TRICK_RW_PLAY_FIRST | It enforces the rule that the player will replay only the first ad break that was leaped over by the user during trick mode rewind operation. |
TRICK_RW_PLAY_LAST | It enforces the rule that the player will replay only the last ad break that was leaped over by the user during trick mode rewind operation. |
TRICK_RW_SKIP_ALL | It enforces the rule that the player will skip all the ad breaks that were leaped over by the user during trick mode rewind operation. |
PlaybackInterruptedRule
Ad playback policy applicable with playback interruption.
Rule | Description |
---|---|
INTERRUPT_SKIP | It enforces the rule that the player will skip the ad break that was interrupted e.g. phone call, etc. |
INTERRUPT_RESTART | It enforces the rule that the player will replay the ad break that was interrupted e.g. phone call, etc. |
INTERRUPT_RESUME | It enforces the rule that the player will resume the ad break that was interrupted e.g. phone call, etc. This is the default rule. |
PlaybackAutoSeekRule
Ad playback policy applicable with playback starting from a initial playback position.
Rule | Description |
---|---|
AUTO_SEEK_SKIP_ALL | It enforces the rule that the player will start the content without forcing the user to watch any ads that are available from the start of the content to the bookmarked time. |
AUTO_SEEK_PLAY_PREROLL | It enforces the rule that the player will force the user to watch the PREROLL ads, while any MIDROLL ads, that are available from the start of the content to the bookmarked time, will be skipped. |
AUTO_SEEK_PLAY_MIDROLL | It enforces the rule that the player will force a user to watch at least one MIDROLL ad, while the PREROLL ads will be skipped. Whether the user has to watch all triggered MIDROLL ads, or only one, is determined by the PlaybackFastForwardRule policy value. |
AUTO_SEEK_PLAY_ALL | It enforces the rule that the player will force a user to watch the PREROLL ads, then one or more MIDROLL ads. Whether the user has to watch all triggered MIDROLL ads, or only one, is determined by the PlaybackFastForwardRule policy value. This is the default rule. |
PlaybackRepeatedRule
Ad playback policy applicable with repeated ad playback in a single playback session.
Rule | Description |
---|---|
REPEAT_ALWAYS_PLAY | It enforces the rule that the player will repeatedly play the ad break, with a given ID, in a single playback session whenever the ad break is triggered. |
REPEAT_PLAY_ONCE | It enforces the rule that the player will play the ad break, with a given ID, only once in a single playback session whenever the ad break is triggered. This is the default rule. |
AdPolicy with SSAI
The ad policy rules can be set while initialising YoSession.
// create ad playback policy
let policy = AdPlaybackPolicy(fastForwardRule: .TRICK_FW_PLAY_ALL,
rewindRule: .TRICK_RW_PLAY_ALL,
interruptRule: .INTERRUPT_RESUME,
autoSeekRule: .AUTO_SEEK_PLAY_ALL,
repeatRule: .REPEAT_PLAY_ONCE)
let initData = FLAdvertisingYospaceFactory.yoSessionInitData(contentUrl: contentUrl, playbackMode: playbackMode)
// initialise ad session with the AdPlaybackPolicy
yoAdSession.initialize(initData: initData, adPlaybackPolicy: policy) { result in
switch result {
case let .success(playbackUrl, status, reason):
// create ad player for playback
case let .failure(error):
// handle error
}
}
Yospace Fallback Handling
yospaceAdsSession.initialize(...)
method resolves with PlaybackUrl, SessionStatus and Reason for Failure which provides detailed information on each sessionState.
yospaceSessionState | Status | Playback Url | Reason |
---|---|---|---|
INITIALISED | success | ${ContentURl with yospace} | NA |
NO_ANALYTICS | fallback | ${fallback url from yospace} | Yospace Session initialization Failed with Status : fallback and errorCode : 0 |
FAILED | error | ${origin url} | Yospace Session initialization Failed with Status : error and errorCode : -1 |
yoAdSession.initialize(initData: initData, adPlaybackPolicy: policy) { result in
switch result {
case let .success(playbackUrl, status, reason):
// create ad player for playback
// This can be used for reporting yospace status and reason for fallback/error.
case let .failure(error):
// handle error
}
}