/** * Sets a custom AdClientFactory to be used in the ad placement process. * This factory can create a custom ad provider, to be used in the ad resolving. * It can also set a custom ad opportunity detector, that iterates through the timed metadata * and creates a list of PlacementOpportunity. This opportunities will be resolved by the ad provider. * * @param adClientFactory * the custom ad client factory. */ void registerAdClientFactory(AdClientFactory adClientFactory);
public interface AdClientFactory {
/**
* Create an ad provider, which will issue the ad resolving requests.
* @param item
* the current media player item
* @return
* the ad provider created
*/
public AdProvider createAdProvider(MediaPlayerItem item);
/**
* Create an opportunity detector.
* Each time a cue point is discovered in the manifest, the detector
* will decide whether it is going to be used in the ad placement process.
* @param item
* the current media player item
* @return
* the opportunity detector created
*/
public PlacementOpportunityDetector createOpportunityDetector(MediaPlayerItem item);
}
public interface PlacementOpportunityDetector {
/**
* Processes the existing timed metadata and returns a list of PlacementOpportunity
* to be resolved by the ad provider.
* If the TimedMetadata is refused the return value is null.
* @param timedMetadataList the list of available timed metadata, which is sorted.
* @param metadata the metadata which can contain the targeting params and the
* custom parameters to be sent to the ad provider.
*/
public List<PlacementOpportunity> process(List<TimedMetadata> timedMetadataList, Metadata metadata);
public PlacementOpportunity process(TimedMetadata timedMetadata, Metadata metadata);
/**
* When the current time has changed due to a seek or due to a live refresh,
* the PlacementOpportunityDetector has to update its logic.
*
* @param currentTime new current time
* @param playbackRange new playback range of the current item
*/
public void updateByTime(long currentTime, TimeRange playbackRange);
}