Set up for customized playback

You can customize or override ad behaviors supported by PSDK in two ways. In either case, you must register the ad policy instance with the PSDK.

To customize ad behaviors, your application can either:

  • Conform to the PTAdPolicySelector protocol and implement all the required policy selection methods.

    This is recommended if you need to override all the default ad behaviors.

  • Override the PTDefaultAdPolicySelector class and provide implementations for only those behaviors that require customization.

    This is recommended if you need to override only some of the default behaviors.

In both cases, do the following.

  1. Register the policy instance to be used by the PSDK through the client factory.
    Note: Any custom ad policy that is registered at the beginning of playback is cleared when the PTMediaPlayer instance is deallocated. Your application must register a policy selector instance every time a new playback session is created.
    For example:
    // Create an instance of the custom policy selector
    PTS5MinuteSkipBreakPolicySelector *adPolicySelector 
         = [[[PTS5MinuteSkipBreakPolicySelector alloc] initWithMediaPlayer:self.player] autorelease];
     
    // register this instance
    [[PTDefaultMediaPlayerClientFactory defaultFactory] registerAdPolicySelector:adPolicySelector];
  2. Implement any customizations.