API elements for ad playback

TVSDK provides classes and methods that you can use to customize the playback behavior of content that contains advertising.

The following API elements are useful for customizing playback:

API element Content that supports advertising
AdvertisingMetadata Control whether an ad break should be marked as having been watched by a viewer, and if yes, when to mark it. Set and get the watched policy using setAdBreakAsWatched and getAdBreakAsWatched.
AdBreakPolicy Enumerates possible playback policies for ad breaks.
AdPolicy Enumerates possible playback policies for ads.
AdPolicySelector Interface that allows customization of TVSDK ad behavior.
DefaultAdPolicySelector Class that implements the default TVSDK behavior. Your application can override this class to customize the default behaviors without implementing the complete interface.
  • getLocalTime

    This is the local time of the playback, excluding the placed ad breaks.

  • seekToLocal.

    Here, the seek occurs relative to a local time in the stream.

  • getTimeline.convertToLocalTime.

    The virtual position on the timeline is converted to the local position.

Important: getLocalTime in MediaPlayer returns the current time relative to the original content, without dynamically spliced ads. getLocalTime in AdBreak returns the start time of the break relative to the original content.

AdBreak isWatched property. Indicates whether the viewer has watched the ad.

On this page