CallbackMediaItem.Builder

public static final class CallbackMediaItem.Builder
extends MediaItem.Builder

java.lang.Object
   ↳ androidx.media2.common.MediaItem.Builder
     ↳ androidx.media2.common.CallbackMediaItem.Builder


This Builder class simplifies the creation of a CallbackMediaItem object.

Summary

Public constructors

CallbackMediaItem.Builder(DataSourceCallback dsc2)

Creates a new Builder object.

Public methods

CallbackMediaItem build()

Build MediaItem.

CallbackMediaItem.Builder setEndPosition(long position)

Sets the end position in milliseconds at which the playback will end.

CallbackMediaItem.Builder setMetadata(MediaMetadata metadata)

Set the metadata of this instance.

CallbackMediaItem.Builder setStartPosition(long position)

Sets the start position in milliseconds at which the playback will start.

Inherited methods

Public constructors

CallbackMediaItem.Builder

public CallbackMediaItem.Builder (DataSourceCallback dsc2)

Creates a new Builder object.

Parameters
dsc2 DataSourceCallback: the DataSourceCallback for the media you want to play

Public methods

build

public CallbackMediaItem build ()

Build MediaItem.

Returns
CallbackMediaItem A new CallbackMediaItem with values supplied by the Builder.

setEndPosition

public CallbackMediaItem.Builder setEndPosition (long position)

Sets the end position in milliseconds at which the playback will end. Any negative number is treated as maximum length of the media item.

Parameters
position long: the end position in milliseconds at which the playback will end

Returns
CallbackMediaItem.Builder this instance for chaining

setMetadata

public CallbackMediaItem.Builder setMetadata (MediaMetadata metadata)

Set the metadata of this instance. null for unset.

Parameters
metadata MediaMetadata: metadata

Returns
CallbackMediaItem.Builder this instance for chaining

setStartPosition

public CallbackMediaItem.Builder setStartPosition (long position)

Sets the start position in milliseconds at which the playback will start. Any negative number is treated as 0.

Parameters
position long: the start position in milliseconds at which the playback will start

Returns
CallbackMediaItem.Builder this instance for chaining