Set up ad insertion metadata

Last update: 2023-10-02

Use the helper class AuditudeSettings, which extends the MetadataNode class, to set up Adobe Primetime ad decisioning metadata.


Adobe Primetime ad decisioning was previously known as Auditude.

Advertising metadata is in the MediaResource.Metadata property. When starting the playback of a new video, your application is responsible for setting the correct advertising metadata.

  1. Build the AuditudeSettings instance.

    AuditudeSettings auditudeSettings = new AuditudeSettings();
  2. Set the Adobe Primetime ad decisioning mediaID, zoneID, domain, and the optional targeting parameters.

    // Optionally set user agent
    Metadata targetingParameters = new Metadata();
    targetingParameters.setValue("desired_param", "desired_value");

    The media ID is consumed by TVSDK as a string, that is converted to an md5 value, and is used for the u value in the Primetime ad decisioning URL request. For example:
  3. Create a MediaResource instance by using the media stream URL and the previously created advertising metadata.

    MediaResource mediaResource = new MediaResource(
    "", MediaResource.Type.HLS, Metadata);
  4. Load the MediaResource object through the MediaPlayer.replaceCurrentResource method.

    The MediaPlayer starts loading and processing the media stream manifest.

  5. When the MediaPlayer transitions to the INITIALIZED status, get the media stream characteristics in the form of a MediaPlayerItem instance through the MediaPlayer.CurrentItem method.

  6. (Optional) Query the MediaPlayerItem instance to see whether the stream is live, regardless of whether it has alternate audio tracks, or whether the stream is protected.

    This information can help you prepare the UI for the playback. For example, if you know there are two audio tracks, you can include a UI control that toggles between these tracks.

  7. Call MediaPlayer.prepareToPlay to start the advertising workflow.

    After the ads have been resolved and placed on the timeline, the MediaPlayer transitions to the PREPARED state.

  8. Call to start the playback.

TVSDK now includes ads when your media plays.

On this page