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:
This is recommended if you need to override all the default ad behaviors.
This is recommended if you need to override only some of the default behaviors.
In both cases, do the following.
// create a Custom Advertising Factory
private AdvertisingFactory createCustomAdvertisingFactory() {
return new AdvertisingFactory() {
...
@Override
public AdPolicySelector createAdPolicySelector(MediaPlayerItem mediaPlayerItem) {
return new CustomAdPolicySelector(mediaPlayerItem);
}
...
};
}
// register the custom advertising factory with media player
advertisingFactory = createCustomAdvertisingFactory();
mediaPlayer.registerAdClientFactory(advertisingFactory);