Back to Exoplayer

SimpleBasePlayer.MediaItemData.Builder (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/SimpleBasePlayer.MediaItemData.Builder.html

latest15.7 KB
Original Source

Package com.google.android.exoplayer2

Class SimpleBasePlayer.MediaItemData.Builder


public static final classSimpleBasePlayer.MediaItemData.Builderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

A builder for SimpleBasePlayer.MediaItemData objects.

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | Builder​(Object uid) | Creates the builder. |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | SimpleBasePlayer.MediaItemData | build() | Builds the SimpleBasePlayer.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 between SystemClock.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 active MediaItem.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 the MediaItem. | | SimpleBasePlayer.MediaItemData.Builder | setMediaMetadata​(MediaMetadata mediaMetadata) | Sets the MediaMetadata. | | 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 the Tracks 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. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

Builder

public Builder​([Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")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.

Method Detail

- 

setUid

@CanIgnoreReturnValue
public[SimpleBasePlayer.MediaItemData.Builder](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")setUid​([Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")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](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")setTracks​([Tracks](Tracks.html "class in com.google.android.exoplayer2")tracks)

Sets the Tracks of this media item. Parameters:tracks - The Tracks of this media item.Returns:This builder.

- 

setMediaItem

@CanIgnoreReturnValue
public[SimpleBasePlayer.MediaItemData.Builder](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")setMediaItem​([MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem)

Sets the MediaItem. Parameters:mediaItem - The MediaItem.Returns:This builder.

- 

setMediaMetadata

@CanIgnoreReturnValue
public[SimpleBasePlayer.MediaItemData.Builder](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")setMediaMetadata​(@Nullable[MediaMetadata](MediaMetadata.html "class in com.google.android.exoplayer2")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.

- 

setManifest

@CanIgnoreReturnValue
public[SimpleBasePlayer.MediaItemData.Builder](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")setManifest​(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")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](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")setLiveConfiguration​(@Nullable[MediaItem.LiveConfiguration](MediaItem.LiveConfiguration.html "class in com.google.android.exoplayer2")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.

- 

setPresentationStartTimeMs

@CanIgnoreReturnValue
public[SimpleBasePlayer.MediaItemData.Builder](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")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.

- 

setWindowStartTimeMs

@CanIgnoreReturnValue
public[SimpleBasePlayer.MediaItemData.Builder](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")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.

- 

setElapsedRealtimeEpochOffsetMs

@CanIgnoreReturnValue
public[SimpleBasePlayer.MediaItemData.Builder](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")setElapsedRealtimeEpochOffsetMs​(long elapsedRealtimeEpochOffsetMs)

Sets the offset between SystemClock.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 between SystemClock.elapsedRealtime() 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.

- 

setIsSeekable

@CanIgnoreReturnValue
public[SimpleBasePlayer.MediaItemData.Builder](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")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](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")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](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")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](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")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.

- 

setPositionInFirstPeriodUs

@CanIgnoreReturnValue
public[SimpleBasePlayer.MediaItemData.Builder](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")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](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")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](SimpleBasePlayer.MediaItemData.Builder.html "class in com.google.android.exoplayer2")setPeriods​([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[SimpleBasePlayer.PeriodData](SimpleBasePlayer.PeriodData.html "class in com.google.android.exoplayer2")> 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](SimpleBasePlayer.MediaItemData.html "class in com.google.android.exoplayer2")build()

Builds the SimpleBasePlayer.MediaItemData.