docs/doc/reference/com/google/android/exoplayer2/source/ConcatenatingMediaSource2.Builder.html
Package com.google.android.exoplayer2.source
Enclosing class:ConcatenatingMediaSource2
public static final classConcatenatingMediaSource2.Builderextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")
A builder for ConcatenatingMediaSource2 instances.
Constructors | Constructor | Description |
| --- | --- |
| Builder() |
Creates the builder.
|
All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| ConcatenatingMediaSource2.Builder | add(MediaItem mediaItem) |
Adds a MediaItem to the concatenation.
|
| ConcatenatingMediaSource2.Builder | add(MediaItem mediaItem, long initialPlaceholderDurationMs) |
Adds a MediaItem to the concatenation and specifies its initial placeholder duration used while the actual duration is still unknown.
|
| ConcatenatingMediaSource2.Builder | add(MediaSource mediaSource) |
Adds a MediaSource to the concatenation.
|
| ConcatenatingMediaSource2.Builder | add(MediaSource mediaSource, long initialPlaceholderDurationMs) |
Adds a MediaSource to the concatenation and specifies its initial placeholder duration used while the actual duration is still unknown.
|
| ConcatenatingMediaSource2 | build() |
Builds the concatenating media source.
|
| ConcatenatingMediaSource2.Builder | setMediaItem(MediaItem mediaItem) |
Sets the MediaItem to be used for the concatenated media source.
|
| ConcatenatingMediaSource2.Builder | setMediaSourceFactory(MediaSource.Factory mediaSourceFactory) |
Sets a MediaSource.Factory that is used to convert MediaItems to MediaSources for all future calls to add(MediaItem) or add(MediaItem, long).
|
| ConcatenatingMediaSource2.Builder | useDefaultMediaSourceFactory(Context context) |
Instructs the builder to use a DefaultMediaSourceFactory to convert MediaItems to MediaSources for all future calls to add(MediaItem) or add(MediaItem, long).
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public Builder()
Creates the builder.
-
@CanIgnoreReturnValue
public[ConcatenatingMediaSource2.Builder](ConcatenatingMediaSource2.Builder.html "class in com.google.android.exoplayer2.source")useDefaultMediaSourceFactory([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context)
Instructs the builder to use a DefaultMediaSourceFactory to convert MediaItems to MediaSources for all future calls to add(MediaItem) or add(MediaItem, long).
Parameters:context - A Context.Returns:This builder.
-
@CanIgnoreReturnValue
public[ConcatenatingMediaSource2.Builder](ConcatenatingMediaSource2.Builder.html "class in com.google.android.exoplayer2.source")setMediaSourceFactory([MediaSource.Factory](MediaSource.Factory.html "interface in com.google.android.exoplayer2.source")mediaSourceFactory)
Sets a MediaSource.Factory that is used to convert MediaItems to MediaSources for all future calls to add(MediaItem) or add(MediaItem, long).
Parameters:mediaSourceFactory - A MediaSource.Factory.Returns:This builder.
-
@CanIgnoreReturnValue
public[ConcatenatingMediaSource2.Builder](ConcatenatingMediaSource2.Builder.html "class in com.google.android.exoplayer2.source")setMediaItem([MediaItem](../MediaItem.html "class in com.google.android.exoplayer2")mediaItem)
Sets the MediaItem to be used for the concatenated media source.
This MediaItem will be used as Timeline.Window.mediaItem for the concatenated source and will be returned by Player.getCurrentMediaItem().
The default is MediaItem.fromUri(Uri.EMPTY).
Parameters:mediaItem - The MediaItem.Returns:This builder.
-
@CanIgnoreReturnValue
public[ConcatenatingMediaSource2.Builder](ConcatenatingMediaSource2.Builder.html "class in com.google.android.exoplayer2.source")add([MediaItem](../MediaItem.html "class in com.google.android.exoplayer2")mediaItem)
Adds a MediaItem to the concatenation.
useDefaultMediaSourceFactory(Context) or setMediaSourceFactory(MediaSource.Factory) must be called before this method.
This method must not be used with media items for progressive media that can't provide their duration with their first Timeline update. Use add(MediaItem, long) instead.
Parameters:mediaItem - The MediaItem.Returns:This builder.
-
@CanIgnoreReturnValue
public[ConcatenatingMediaSource2.Builder](ConcatenatingMediaSource2.Builder.html "class in com.google.android.exoplayer2.source")add([MediaItem](../MediaItem.html "class in com.google.android.exoplayer2")mediaItem,
long initialPlaceholderDurationMs)
Adds a MediaItem to the concatenation and specifies its initial placeholder duration used while the actual duration is still unknown.
useDefaultMediaSourceFactory(Context) or setMediaSourceFactory(MediaSource.Factory) must be called before this method.
Setting a placeholder duration is required for media items for progressive media that can't provide their duration with their first Timeline update. It may also be used for other items to make the duration known immediately.
Parameters:mediaItem - The MediaItem.initialPlaceholderDurationMs - The initial placeholder duration in milliseconds used while the actual duration is still unknown, or C.TIME_UNSET to not define one. The placeholder duration is used for every Timeline.Window defined by Timeline of the MediaItem.Returns:This builder.
-
@CanIgnoreReturnValue
public[ConcatenatingMediaSource2.Builder](ConcatenatingMediaSource2.Builder.html "class in com.google.android.exoplayer2.source")add([MediaSource](MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource)
Adds a MediaSource to the concatenation.
This method must not be used for sources like ProgressiveMediaSource that can't provide their duration with their first Timeline update. Use add(MediaSource, long) instead.
Parameters:mediaSource - The MediaSource.Returns:This builder.
-
@CanIgnoreReturnValue
public[ConcatenatingMediaSource2.Builder](ConcatenatingMediaSource2.Builder.html "class in com.google.android.exoplayer2.source")add([MediaSource](MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource,
long initialPlaceholderDurationMs)
Adds a MediaSource to the concatenation and specifies its initial placeholder duration used while the actual duration is still unknown.
Setting a placeholder duration is required for sources like ProgressiveMediaSource that can't provide their duration with their first Timeline update. It may also be used for other sources to make the duration known immediately.
Parameters:mediaSource - The MediaSource.initialPlaceholderDurationMs - The initial placeholder duration in milliseconds used while the actual duration is still unknown, or C.TIME_UNSET to not define one. The placeholder duration is used for every Timeline.Window defined by Timeline of the MediaSource.Returns:This builder.
-
public[ConcatenatingMediaSource2](ConcatenatingMediaSource2.html "class in com.google.android.exoplayer2.source")build()
Builds the concatenating media source.