HlsMediaPlaylist.Interstitial.Builder


public final class HlsMediaPlaylist.Interstitial.Builder


Builder for Interstitial.

See RFC 8216bis, section 4.4.5.1 for how to consolidate multiple interstitials with the same ID.

Summary

Public constructors

Creates the builder.

Public methods

@Nullable HlsMediaPlaylist.Interstitial

Builds and returns a new Interstitial instance or null if validation of the properties fails.

HlsMediaPlaylist.Interstitial.Builder

Sets the asset list URI.

HlsMediaPlaylist.Interstitial.Builder

Sets the asset URI.

HlsMediaPlaylist.Interstitial.Builder

Sets the client defined attributes.

HlsMediaPlaylist.Interstitial.Builder

Sets whether the content may vary between clients.

HlsMediaPlaylist.Interstitial.Builder

Sets the cue trigger types.

HlsMediaPlaylist.Interstitial.Builder

Sets the duration, in microseconds.

HlsMediaPlaylist.Interstitial.Builder

Sets the end date as a unix epoch timestamp, in microseconds.

HlsMediaPlaylist.Interstitial.Builder

Sets whether the interstitial ends on the start time of the next interstitial.

HlsMediaPlaylist.Interstitial.Builder

Sets the planned duration, in microseconds.

HlsMediaPlaylist.Interstitial.Builder

Sets the play out limit, in microseconds.

HlsMediaPlaylist.Interstitial.Builder

Sets the navigation restrictions.

HlsMediaPlaylist.Interstitial.Builder

Sets the resume offset, in microseconds.

HlsMediaPlaylist.Interstitial.Builder

Sets the snap types.

HlsMediaPlaylist.Interstitial.Builder

Sets the start date as a unix epoch timestamp, in microseconds.

HlsMediaPlaylist.Interstitial.Builder

Sets the timeline occupies type.

HlsMediaPlaylist.Interstitial.Builder

Sets the timeline style type.

Public constructors

Builder

public Builder(String id)

Creates the builder.

Parameters
String id

The id.

Public methods

build

public @Nullable HlsMediaPlaylist.Interstitial build()

Builds and returns a new Interstitial instance or null if validation of the properties fails. The properties are considered invalid, if the start date is missing or both asset URI and asset list URI are set at the same time.

setAssetListUri

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setAssetListUri(@Nullable Uri assetListUri)

Sets the asset list URI.

Throws
java.lang.IllegalArgumentException

if called with a non-null value that is different to the value previously set.

setAssetUri

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setAssetUri(@Nullable Uri assetUri)

Sets the asset URI.

Throws
java.lang.IllegalArgumentException

if called with a non-null value that is different to the value previously set.

setClientDefinedAttributes

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setClientDefinedAttributes(
    List<HlsMediaPlaylist.ClientDefinedAttribute> clientDefinedAttributes
)

Sets the client defined attributes.

Equal duplicates are ignored, new attributes are added to those already set.

Throws
java.lang.IllegalArgumentException

if called with a list containing a client defined attribute that is not equal with an attribute previously set with the same name.

setContentMayVary

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setContentMayVary(@Nullable Boolean contentMayVary)

Sets whether the content may vary between clients.

The default value is true .

Parameters
@Nullable Boolean contentMayVary

Whether the content may vary.

Throws
java.lang.IllegalArgumentException

if attempting to change a value that is already set to a different value.

setCue

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setCue(List<@HlsMediaPlaylist.Interstitial.CueTriggerType String> cue)

Sets the cue trigger types.

Throws
java.lang.IllegalArgumentException

if called with a value different to TIME_UNSET and different to the value previously set.

setDurationUs

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setDurationUs(long durationUs)

Sets the duration, in microseconds.

Throws
java.lang.IllegalArgumentException

if called with a value different to TIME_UNSET and different to the value previously set.

setEndDateUnixUs

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setEndDateUnixUs(long endDateUnixUs)

Sets the end date as a unix epoch timestamp, in microseconds.

Throws
java.lang.IllegalArgumentException

if called with a value different to TIME_UNSET and different to the value previously set.

setEndOnNext

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setEndOnNext(boolean endOnNext)

Sets whether the interstitial ends on the start time of the next interstitial.

Once set to true, it can't be reset to false and doing so would be ignored.

setPlannedDurationUs

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setPlannedDurationUs(long plannedDurationUs)

Sets the planned duration, in microseconds.

Throws
java.lang.IllegalArgumentException

if called with a value different to TIME_UNSET and different to the value previously set.

setPlayoutLimitUs

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setPlayoutLimitUs(long playoutLimitUs)

Sets the play out limit, in microseconds.

Throws
java.lang.IllegalArgumentException

if called with a value different to TIME_UNSET and different to the value previously set.

setRestrictions

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setRestrictions(
    List<@HlsMediaPlaylist.Interstitial.NavigationRestriction String> restrictions
)

Sets the navigation restrictions.

Throws
java.lang.IllegalArgumentException

if called with a non-empty list of restrictions that is not equal to the non-empty list that was previously set.

setResumeOffsetUs

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setResumeOffsetUs(long resumeOffsetUs)

Sets the resume offset, in microseconds.

Throws
java.lang.IllegalArgumentException

if called with a value different to TIME_UNSET and different to the value previously set.

setSnapTypes

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setSnapTypes(
    List<@HlsMediaPlaylist.Interstitial.SnapType String> snapTypes
)

Sets the snap types.

Throws
java.lang.IllegalArgumentException

if called with a non-empty list of snap types that is not equal to the non-empty list that was previously set.

setStartDateUnixUs

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setStartDateUnixUs(long startDateUnixUs)

Sets the start date as a unix epoch timestamp, in microseconds.

Throws
java.lang.IllegalArgumentException

if called with a value different to TIME_UNSET and different to the value previously set.

setTimelineOccupies

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setTimelineOccupies(
    @HlsMediaPlaylist.Interstitial.TimelineOccupiesType @Nullable @HlsMediaPlaylist.Interstitial.TimelineOccupiesType String timelineOccupies
)

Sets the timeline occupies type.

The default value is TIMELINE_OCCUPIES_POINT.

Throws
java.lang.IllegalArgumentException

if attempting to change a value that is already set to a different value.

setTimelineStyle

@CanIgnoreReturnValue
public HlsMediaPlaylist.Interstitial.Builder setTimelineStyle(
    @HlsMediaPlaylist.Interstitial.TimelineStyleType @Nullable @HlsMediaPlaylist.Interstitial.TimelineStyleType String timelineStyle
)

Sets the timeline style type. The default value is TIMELINE_STYLE_HIGHLIGHT.

Throws
java.lang.IllegalArgumentException

if attempting to change from a non-default value to a different non-default value.