SimpleBasePlayer.MediaItemData.Builder


public final class SimpleBasePlayer.MediaItemData.Builder


A builder for MediaItemData objects.

Summary

Public constructors

Creates the builder.

Public methods

SimpleBasePlayer.MediaItemData

Builds the MediaItemData.

SimpleBasePlayer.MediaItemData.Builder

Sets the default position relative to the start of the media item at which to begin playback, in microseconds.

SimpleBasePlayer.MediaItemData.Builder

Sets the duration of the media item, in microseconds.

SimpleBasePlayer.MediaItemData.Builder
@CanIgnoreReturnValue
setElapsedRealtimeEpochOffsetMs(long elapsedRealtimeEpochOffsetMs)

Sets the offset between elapsedRealtime and the time since the Unix epoch according to the clock of the media origin server.

SimpleBasePlayer.MediaItemData.Builder

Sets whether this media item may change over time, for example a moving live window.

SimpleBasePlayer.MediaItemData.Builder
@CanIgnoreReturnValue
setIsPlaceholder(boolean isPlaceholder)

Sets whether this media item contains placeholder information because the real information has yet to be loaded.

SimpleBasePlayer.MediaItemData.Builder
@CanIgnoreReturnValue
setIsSeekable(boolean isSeekable)

Sets whether it's possible to seek within this media item.

SimpleBasePlayer.MediaItemData.Builder

Sets the active MediaItem.LiveConfiguration, or null if the media item is not live.

SimpleBasePlayer.MediaItemData.Builder

Sets the manifest of the media item.

SimpleBasePlayer.MediaItemData.Builder

Sets the MediaItem.

SimpleBasePlayer.MediaItemData.Builder

Sets the MediaMetadata.

SimpleBasePlayer.MediaItemData.Builder

Sets the list of periods in this media item.

SimpleBasePlayer.MediaItemData.Builder
@CanIgnoreReturnValue
setPositionInFirstPeriodUs(long positionInFirstPeriodUs)

Sets the position of the start of this media item relative to the start of the first period belonging to it, in microseconds.

SimpleBasePlayer.MediaItemData.Builder
@CanIgnoreReturnValue
setPresentationStartTimeMs(long presentationStartTimeMs)

Sets the start time of the live presentation.

SimpleBasePlayer.MediaItemData.Builder

Sets the Tracks of this media item.

SimpleBasePlayer.MediaItemData.Builder

Sets the unique identifier of this media item within a playlist.

SimpleBasePlayer.MediaItemData.Builder

Sets the start time of the live window.

Public constructors

Builder

public Builder(Object uid)

Creates the builder.

Parameters
Object uid

The unique identifier of the media item within a playlist. This value will be set as uid for this item.

Public methods

build

public SimpleBasePlayer.MediaItemData build()

Builds the MediaItemData.

setDefaultPositionUs

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setDefaultPositionUs(long defaultPositionUs)

Sets the default position relative to the start of the media item at which to begin playback, in microseconds.

The default position must be less or equal to the duration, if set.

Parameters
long defaultPositionUs

The default position relative to the start of the media item at which to begin playback, in microseconds.

setDurationUs

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setDurationUs(long durationUs)

Sets the duration of the media item, in microseconds.

If both this duration and all period durations are set, the sum of this duration and the offset in the first period must match the total duration of all periods.

Parameters
long durationUs

The duration of the media item, in microseconds, or TIME_UNSET if unknown.

setElapsedRealtimeEpochOffsetMs

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setElapsedRealtimeEpochOffsetMs(long elapsedRealtimeEpochOffsetMs)

Sets the offset between elapsedRealtime and the time since the Unix epoch according to the clock of the media origin server.

This value can only be set to anything other than TIME_UNSET if the stream is live.

Parameters
long elapsedRealtimeEpochOffsetMs

The offset between elapsedRealtime and the time since the Unix epoch according to the clock of the media origin server, or TIME_UNSET if unknown or not applicable.

setIsDynamic

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setIsDynamic(boolean isDynamic)

Sets whether this media item may change over time, for example a moving live window.

Parameters
boolean isDynamic

Whether this media item may change over time, for example a moving live window.

setIsPlaceholder

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setIsPlaceholder(boolean isPlaceholder)

Sets whether this media item contains placeholder information because the real information has yet to be loaded.

Parameters
boolean isPlaceholder

Whether this media item contains placeholder information because the real information has yet to be loaded.

setIsSeekable

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setIsSeekable(boolean isSeekable)

Sets whether it's possible to seek within this media item.

Parameters
boolean isSeekable

Whether it's possible to seek within this media item.

setLiveConfiguration

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setLiveConfiguration(
    @Nullable MediaItem.LiveConfiguration liveConfiguration
)

Sets the active MediaItem.LiveConfiguration, or null if the media item is not live.

Parameters
@Nullable MediaItem.LiveConfiguration liveConfiguration

The active MediaItem.LiveConfiguration, or null if the media item is not live.

setManifest

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setManifest(@Nullable Object manifest)

Sets the manifest of the media item.

Parameters
@Nullable Object manifest

The manifest of the media item, or null if not applicable.

setMediaItem

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setMediaItem(MediaItem mediaItem)

Sets the MediaItem.

Parameters
MediaItem mediaItem

The MediaItem.

setMediaMetadata

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setMediaMetadata(@Nullable MediaMetadata mediaMetadata)

Sets the MediaMetadata.

This data includes static data from the MediaItem and the media's Format, as well any dynamic metadata that has been parsed from the media. If null, the metadata is assumed to be the simple combination of the MediaItem metadata and the metadata of the selected Formats.

Parameters
@Nullable MediaMetadata mediaMetadata

The MediaMetadata, or null to assume that the metadata is the simple combination of the MediaItem metadata and the metadata of the selected Formats.

setPeriods

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setPeriods(List<SimpleBasePlayer.PeriodData> periods)

Sets the list of periods in this media item.

All periods must have unique UIDs and only the last period is allowed to have an unset duration.

Parameters
List<SimpleBasePlayer.PeriodData> periods

The list of periods in this media item, or an empty list to assume a single period without ads and the same duration as the media item.

setPositionInFirstPeriodUs

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setPositionInFirstPeriodUs(long positionInFirstPeriodUs)

Sets the position of the start of this media item relative to the start of the first period belonging to it, in microseconds.

Parameters
long positionInFirstPeriodUs

The position of the start of this media item relative to the start of the first period belonging to it, in microseconds.

setPresentationStartTimeMs

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setPresentationStartTimeMs(long presentationStartTimeMs)

Sets the start time of the live presentation.

This value can only be set to anything other than TIME_UNSET if the stream is live.

Parameters
long presentationStartTimeMs

The start time of the live presentation, in milliseconds since the Unix epoch, or TIME_UNSET if unknown or not applicable.

setTracks

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setTracks(Tracks tracks)

Sets the Tracks of this media item.

Parameters
Tracks tracks

The Tracks of this media item.

setUid

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setUid(Object uid)

Sets the unique identifier of this media item within a playlist.

This value will be set as uid for this item.

Parameters
Object uid

The unique identifier of this media item within a playlist.

setWindowStartTimeMs

@CanIgnoreReturnValue
public SimpleBasePlayer.MediaItemData.Builder setWindowStartTimeMs(long windowStartTimeMs)

Sets the start time of the live window.

This value can only be set to anything other than TIME_UNSET if the stream is live. The value should also be greater or equal than the presentation start time, if set.

Parameters
long windowStartTimeMs

The start time of the live window, in milliseconds since the Unix epoch, or TIME_UNSET if unknown or not applicable.