Control the seek-over-ads behavior

You can override the default behavior for how the PSDK handles seeks over ads when using custom ad markers.

The PSDK implements a default behavior when a seek operation is performed over an ad-break section: the playhead position is forcibly adjusted to the beginning of the last ad-break section that was skipped over.

You can enable this type of functionality for ad-content sections that result from the placement of custom ad markers. It is disabled by default.

  1. Configure a Metadata instance with the appropriate key/value pair (the DefaultMetadataKeys.METADATA_KEY_ADJUST_SEEK_ENABLED enumeration entry) that enables the "adjustable-seek-position" feature.

    The key value must be set to "true" as the actual literal string and not the true Boolean value.

    Metadata metadata = new MetadataNode();
    metadata.setValue(DefaultMetadataKeys.METADATA_KEY_ADJUST_SEEK_ENABLED.getValue(),"true");
    
  2. Create and configure a MediaResource instance, passing the additional configuration options to the TimeRangeCollection#toMetada method. This method receives additional configuration options via another generic metadata structure.
    MediaResource mediaResource = MediaResource.createFromUrl("www.example.com/video/test_video.m3u8",
    timeRanges.toMedatada(metadata));