ConcatenatingMediaSource2.Builder


class ConcatenatingMediaSource2.Builder


A builder for ConcatenatingMediaSource2 instances.

Summary

Public constructors

Creates the builder.

Public functions

ConcatenatingMediaSource2.Builder!

Adds a MediaItem to the concatenation.

ConcatenatingMediaSource2.Builder!

Adds a MediaSource to the concatenation.

ConcatenatingMediaSource2.Builder!
@CanIgnoreReturnValue
add(mediaItem: MediaItem!, initialPlaceholderDurationMs: Long)

Adds a MediaItem to the concatenation and specifies its initial placeholder duration used while the actual duration is still unknown.

ConcatenatingMediaSource2.Builder!
@CanIgnoreReturnValue
add(mediaSource: MediaSource!, initialPlaceholderDurationMs: Long)

Adds a MediaSource to the concatenation and specifies its initial placeholder duration used while the actual duration is still unknown.

ConcatenatingMediaSource2!

Builds the concatenating media source.

ConcatenatingMediaSource2.Builder!

Sets the MediaItem to be used for the concatenated media source.

ConcatenatingMediaSource2.Builder!

Sets a MediaSource.Factory that is used to convert MediaItems to MediaSources for all future calls to add or add.

ConcatenatingMediaSource2.Builder!

Instructs the builder to use a DefaultMediaSourceFactory to convert MediaItems to MediaSources for all future calls to add or add.

Public constructors

Builder

Builder()

Creates the builder.

Public functions

add

@CanIgnoreReturnValue
fun add(mediaItem: MediaItem!): ConcatenatingMediaSource2.Builder!

Adds a MediaItem to the concatenation.

useDefaultMediaSourceFactory or setMediaSourceFactory 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 instead.

Parameters
mediaItem: MediaItem!

The MediaItem.

Returns
ConcatenatingMediaSource2.Builder!

This builder.

add

@CanIgnoreReturnValue
fun add(mediaSource: MediaSource!): ConcatenatingMediaSource2.Builder!

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 instead.

Parameters
mediaSource: MediaSource!

The MediaSource.

Returns
ConcatenatingMediaSource2.Builder!

This builder.

add

@CanIgnoreReturnValue
fun add(mediaItem: MediaItem!, initialPlaceholderDurationMs: Long): ConcatenatingMediaSource2.Builder!

Adds a MediaItem to the concatenation and specifies its initial placeholder duration used while the actual duration is still unknown.

useDefaultMediaSourceFactory or setMediaSourceFactory 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: MediaItem!

The MediaItem.

initialPlaceholderDurationMs: Long

The initial placeholder duration in milliseconds used while the actual duration is still unknown, or TIME_UNSET to not define one. The placeholder duration is used for every Timeline.Window defined by of the MediaItem.

Returns
ConcatenatingMediaSource2.Builder!

This builder.

add

@CanIgnoreReturnValue
fun add(mediaSource: MediaSource!, initialPlaceholderDurationMs: Long): ConcatenatingMediaSource2.Builder!

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: MediaSource!

The MediaSource.

initialPlaceholderDurationMs: Long

The initial placeholder duration in milliseconds used while the actual duration is still unknown, or TIME_UNSET to not define one. The placeholder duration is used for every Timeline.Window defined by of the MediaSource.

Returns
ConcatenatingMediaSource2.Builder!

This builder.

build

fun build(): ConcatenatingMediaSource2!

Builds the concatenating media source.

setMediaItem

@CanIgnoreReturnValue
fun setMediaItem(mediaItem: MediaItem!): ConcatenatingMediaSource2.Builder!

Sets the MediaItem to be used for the concatenated media source.

This MediaItem will be used as mediaItem for the concatenated source and will be returned by getCurrentMediaItem.

The default is MediaItem.fromUri(Uri.EMPTY).

Parameters
mediaItem: MediaItem!

The MediaItem.

Returns
ConcatenatingMediaSource2.Builder!

This builder.

setMediaSourceFactory

@CanIgnoreReturnValue
fun setMediaSourceFactory(mediaSourceFactory: MediaSource.Factory!): ConcatenatingMediaSource2.Builder!

Sets a MediaSource.Factory that is used to convert MediaItems to MediaSources for all future calls to add or add.

Parameters
mediaSourceFactory: MediaSource.Factory!

A MediaSource.Factory.

Returns
ConcatenatingMediaSource2.Builder!

This builder.

useDefaultMediaSourceFactory

@CanIgnoreReturnValue
fun useDefaultMediaSourceFactory(context: Context!): ConcatenatingMediaSource2.Builder!

Instructs the builder to use a DefaultMediaSourceFactory to convert MediaItems to MediaSources for all future calls to add or add.

Parameters
context: Context!

A Context.

Returns
ConcatenatingMediaSource2.Builder!

This builder.