Update ad-playback behavior for PSDK 1.3

The way in which ad break behavior is controlled has changed. In addition, some API elements have changed or been renamed as a result.

Ad behavior changes include:
  • The AdBreakPolicySelector interface is replaced by AdPolicySelector, which has the following methods:
    • public AdBreakPolicy selectPolicyForAdBreak(AdPolicyInfo adPolicyInfo);
    • public List<AdBreakPlacement> selectAdBreaksToPlay(AdPolicyInfo adPolicyInfo);
    • public AdPolicy selectPolicyForSeekIntoAd(AdPolicyInfo adPolicyInfo);
    • public AdBreakAsWatched selectWatchedPolicyForAdBreak(AdPolicyInfo adPolicyInfo);
  • The DefaultAdBreakPolicySelector class is replaced by DefaultAdPolicySelector, which implements AdPolicySelector.

To reproduce the same ad behavior as in the PSDK 1.2:

Create a CustomAdPolicySelector class that either extends the DefaultAdPolicySelector class or implements the AdPolicySelector interface. In CustomAdPolicySelector:
  1. Override the selectPolicyForAdBreak method. For normal playback, make sure that it returns the same AdBreakPolicy as in the PSDK 1.2. For example:
    • Return AdBreakPolicy.PLAY if your old ad breaks are always kept on the timeline after play.
    • Return AdBreakPolicy.REMOVE if your old ad breaks are always removed from the timeline after play.
  2. Override selectAdBreaksToPlay method and implement:
    • Return the last AdBreak whenever a seek forward occurs. (Note: Playback resumes from the desired seek position instead of from the ad break end position.)
    • Return null whenever a seek backward occurs.
  3. Override selectPolicyForSeekIntoAd method and implement:
    • Return AdPolicy.PLAY_FROM_AD_BREAK_BEGIN whenever a seek forward occurs.
    • Return AdPolicy.SKIP_AD_BREAK whenever a seek backward occurs.