Class SimpleBasePlayer.MediaItemData.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.SimpleBasePlayer.MediaItemData.Builder
-
- Enclosing class:
- SimpleBasePlayer.MediaItemData
public static final class SimpleBasePlayer.MediaItemData.Builder extends Object
A builder forSimpleBasePlayer.MediaItemData
objects.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleBasePlayer.MediaItemData
build()
Builds theSimpleBasePlayer.MediaItemData
.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.SimpleBasePlayer.MediaItemData.Builder
setDurationUs(long durationUs)
Sets the duration of the media item, in microseconds.SimpleBasePlayer.MediaItemData.Builder
setElapsedRealtimeEpochOffsetMs(long elapsedRealtimeEpochOffsetMs)
Sets the offset betweenSystemClock.elapsedRealtime()
and the time since the Unix epoch according to the clock of the media origin server.SimpleBasePlayer.MediaItemData.Builder
setIsDynamic(boolean isDynamic)
Sets whether this media item may change over time, for example a moving live window.SimpleBasePlayer.MediaItemData.Builder
setIsPlaceholder(boolean isPlaceholder)
Sets whether this media item contains placeholder information because the real information has yet to be loaded.SimpleBasePlayer.MediaItemData.Builder
setIsSeekable(boolean isSeekable)
Sets whether it's possible to seek within this media item.SimpleBasePlayer.MediaItemData.Builder
setLiveConfiguration(MediaItem.LiveConfiguration liveConfiguration)
Sets the activeMediaItem.LiveConfiguration
, or null if the media item is not live.SimpleBasePlayer.MediaItemData.Builder
setManifest(Object manifest)
Sets the manifest of the media item.SimpleBasePlayer.MediaItemData.Builder
setMediaItem(MediaItem mediaItem)
Sets theMediaItem
.SimpleBasePlayer.MediaItemData.Builder
setMediaMetadata(MediaMetadata mediaMetadata)
Sets theMediaMetadata
.SimpleBasePlayer.MediaItemData.Builder
setPeriods(List<SimpleBasePlayer.PeriodData> periods)
Sets the list of periods in this media item.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.SimpleBasePlayer.MediaItemData.Builder
setPresentationStartTimeMs(long presentationStartTimeMs)
Sets the start time of the live presentation.SimpleBasePlayer.MediaItemData.Builder
setTracks(Tracks tracks)
Sets theTracks
of this media item.SimpleBasePlayer.MediaItemData.Builder
setUid(Object uid)
Sets the unique identifier of this media item within a playlist.SimpleBasePlayer.MediaItemData.Builder
setWindowStartTimeMs(long windowStartTimeMs)
Sets the start time of the live window.
-
-
-
Constructor Detail
-
Builder
public Builder(Object uid)
Creates the builder.- Parameters:
uid
- The unique identifier of the media item within a playlist. This value will be set asTimeline.Window.uid
for this item.
-
-
Method Detail
-
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
Timeline.Window.uid
for this item.- Parameters:
uid
- The unique identifier of this media item within a playlist.- Returns:
- This builder.
-
setTracks
@CanIgnoreReturnValue public SimpleBasePlayer.MediaItemData.Builder setTracks(Tracks tracks)
Sets theTracks
of this media item.- Parameters:
tracks
- TheTracks
of this media item.- Returns:
- This builder.
-
setMediaItem
@CanIgnoreReturnValue public SimpleBasePlayer.MediaItemData.Builder setMediaItem(MediaItem mediaItem)
Sets theMediaItem
.- Parameters:
mediaItem
- TheMediaItem
.- Returns:
- This builder.
-
setMediaMetadata
@CanIgnoreReturnValue public SimpleBasePlayer.MediaItemData.Builder setMediaMetadata(@Nullable MediaMetadata mediaMetadata)
Sets theMediaMetadata
.This data includes static data from the
MediaItem
and the media'sFormat
, as well any dynamic metadata that has been parsed from the media. If null, the metadata is assumed to be the simple combination of theMediaItem
metadata and the metadata of the selectedFormats
.- Parameters:
mediaMetadata
- TheMediaMetadata
, or null to assume that the metadata is the simple combination of theMediaItem
metadata and the metadata of the selectedFormats
.- Returns:
- This builder.
-
setManifest
@CanIgnoreReturnValue public SimpleBasePlayer.MediaItemData.Builder setManifest(@Nullable 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.
-
setLiveConfiguration
@CanIgnoreReturnValue public SimpleBasePlayer.MediaItemData.Builder setLiveConfiguration(@Nullable MediaItem.LiveConfiguration liveConfiguration)
Sets the activeMediaItem.LiveConfiguration
, or null if the media item is not live.- Parameters:
liveConfiguration
- The activeMediaItem.LiveConfiguration
, or null if the media item is not live.- Returns:
- This builder.
-
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
C.TIME_UNSET
if the stream is live.- Parameters:
presentationStartTimeMs
- The start time of the live presentation, in milliseconds since the Unix epoch, orC.TIME_UNSET
if unknown or not applicable.- Returns:
- This builder.
-
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
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, orC.TIME_UNSET
if unknown or not applicable.- Returns:
- This builder.
-
setElapsedRealtimeEpochOffsetMs
@CanIgnoreReturnValue public SimpleBasePlayer.MediaItemData.Builder setElapsedRealtimeEpochOffsetMs(long elapsedRealtimeEpochOffsetMs)
Sets the offset betweenSystemClock.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
C.TIME_UNSET
if the stream is live.- Parameters:
elapsedRealtimeEpochOffsetMs
- The offset betweenSystemClock.elapsedRealtime()
and the time since the Unix epoch according to the clock of the media origin server, orC.TIME_UNSET
if unknown or not applicable.- Returns:
- This builder.
-
setIsSeekable
@CanIgnoreReturnValue 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.
-
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:
isDynamic
- Whether this media item may change over time, for example a moving live window.- Returns:
- This builder.
-
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, is set.
- Parameters:
defaultPositionUs
- The default position relative to the start of the media item at which to begin playback, in microseconds.- Returns:
- This builder.
-
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:
durationUs
- The duration of the media item, in microseconds, orC.TIME_UNSET
if unknown.- Returns:
- This builder.
-
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:
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.
-
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:
isPlaceholder
- Whether this media item contains placeholder information because the real information has yet to be loaded.- Returns:
- This builder.
-
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:
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.
-
build
public SimpleBasePlayer.MediaItemData build()
Builds theSimpleBasePlayer.MediaItemData
.
-
-