Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

Builder

class Builder : MediaItem.Builder
kotlin.Any
   ↳ androidx.media2.common.MediaItem.Builder
   ↳ androidx.media2.common.CallbackMediaItem.Builder

This Builder class simplifies the creation of a CallbackMediaItem object.

Summary

Public constructors

<init>(@NonNull dsc2: DataSourceCallback)

Creates a new Builder object.

Public methods

CallbackMediaItem

CallbackMediaItem.Builder
setEndPosition(position: Long)

CallbackMediaItem.Builder
setMetadata(@Nullable metadata: MediaMetadata?)

CallbackMediaItem.Builder

Public constructors

<init>

Builder(@NonNull dsc2: DataSourceCallback)

Creates a new Builder object.

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

Public methods

build

@NonNull fun build(): CallbackMediaItem
Return
CallbackMediaItem: A new CallbackMediaItem with values supplied by the Builder.

setEndPosition

@NonNull fun setEndPosition(position: Long): CallbackMediaItem.Builder

setMetadata

@NonNull fun setMetadata(@Nullable metadata: MediaMetadata?): CallbackMediaItem.Builder

setStartPosition

@NonNull fun setStartPosition(position: Long): CallbackMediaItem.Builder