public final class

SimpleBasePlayer.MediaItemData.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.common.SimpleBasePlayer.MediaItemData.Builder

Overview

A builder for SimpleBasePlayer.MediaItemData objects.

Summary

Constructors
publicBuilder(java.lang.Object uid)

Creates the builder.

Methods
public SimpleBasePlayer.MediaItemDatabuild()

Builds the SimpleBasePlayer.MediaItemData.

public SimpleBasePlayer.MediaItemData.BuildersetDefaultPositionUs(long defaultPositionUs)

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

public SimpleBasePlayer.MediaItemData.BuildersetDurationUs(long durationUs)

Sets the duration of the media item, in microseconds.

public SimpleBasePlayer.MediaItemData.BuildersetElapsedRealtimeEpochOffsetMs(long elapsedRealtimeEpochOffsetMs)

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

public SimpleBasePlayer.MediaItemData.BuildersetIsDynamic(boolean isDynamic)

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

public SimpleBasePlayer.MediaItemData.BuildersetIsPlaceholder(boolean isPlaceholder)

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

public SimpleBasePlayer.MediaItemData.BuildersetIsSeekable(boolean isSeekable)

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

public SimpleBasePlayer.MediaItemData.BuildersetLiveConfiguration(MediaItem.LiveConfiguration liveConfiguration)

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

public SimpleBasePlayer.MediaItemData.BuildersetManifest(java.lang.Object manifest)

Sets the manifest of the media item.

public SimpleBasePlayer.MediaItemData.BuildersetMediaItem(MediaItem mediaItem)

Sets the MediaItem.

public SimpleBasePlayer.MediaItemData.BuildersetMediaMetadata(MediaMetadata mediaMetadata)

Sets the MediaMetadata.

public SimpleBasePlayer.MediaItemData.BuildersetPeriods(java.util.List<SimpleBasePlayer.PeriodData> periods)

Sets the list of periods in this media item.

public SimpleBasePlayer.MediaItemData.BuildersetPositionInFirstPeriodUs(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.

public SimpleBasePlayer.MediaItemData.BuildersetPresentationStartTimeMs(long presentationStartTimeMs)

Sets the start time of the live presentation.

public SimpleBasePlayer.MediaItemData.BuildersetTracks(Tracks tracks)

Sets the Tracks of this media item.

public SimpleBasePlayer.MediaItemData.BuildersetUid(java.lang.Object uid)

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

public SimpleBasePlayer.MediaItemData.BuildersetWindowStartTimeMs(long windowStartTimeMs)

Sets the start time of the live window.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(java.lang.Object uid)

Creates the builder.

Parameters:

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

Methods

public SimpleBasePlayer.MediaItemData.Builder setUid(java.lang.Object uid)

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

This value will be set as Timeline.Window.uid for this item.

Parameters:

uid: The unique identifier of this media item within a playlist.

Returns:

This builder.

Sets the Tracks of this media item.

Parameters:

tracks: The Tracks of this media item.

Returns:

This builder.

public SimpleBasePlayer.MediaItemData.Builder setMediaItem(MediaItem mediaItem)

Sets the MediaItem.

Parameters:

mediaItem: The MediaItem.

Returns:

This builder.

public SimpleBasePlayer.MediaItemData.Builder setMediaMetadata(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:

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.

Returns:

This builder.

public SimpleBasePlayer.MediaItemData.Builder setManifest(java.lang.Object manifest)

Sets the manifest of the media item.

Parameters:

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

Returns:

This builder.

public SimpleBasePlayer.MediaItemData.Builder setLiveConfiguration(MediaItem.LiveConfiguration liveConfiguration)

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

Parameters:

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

Returns:

This builder.

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 C.TIME_UNSET if the stream is live.

Parameters:

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

Returns:

This builder.

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 C.TIME_UNSET if the stream is live. The value should also be greater or equal than the presentation start time, if set.

Parameters:

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

Returns:

This builder.

public SimpleBasePlayer.MediaItemData.Builder setElapsedRealtimeEpochOffsetMs(long elapsedRealtimeEpochOffsetMs)

Sets the offset between 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 C.TIME_UNSET if the stream is live.

Parameters:

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

Returns:

This builder.

public SimpleBasePlayer.MediaItemData.Builder setIsSeekable(boolean isSeekable)

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

Parameters:

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

Returns:

This builder.

public SimpleBasePlayer.MediaItemData.Builder setIsDynamic(boolean isDynamic)

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

Parameters:

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

Returns:

This builder.

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:

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

Returns:

This builder.

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:

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

Returns:

This builder.

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:

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

Returns:

This builder.

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:

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

Returns:

This builder.

public SimpleBasePlayer.MediaItemData.Builder setPeriods(java.util.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:

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.

Returns:

This builder.

Builds the SimpleBasePlayer.MediaItemData.