MediaItem.Builder

Added in 1.0.0
Deprecated in 1.3.0

class MediaItem.Builder

Known direct subclasses
CallbackMediaItem.Builder

This class is deprecated.

androidx.media2 is deprecated.

FileMediaItem.Builder

This class is deprecated.

androidx.media2 is deprecated.

UriMediaItem.Builder

This class is deprecated.

androidx.media2 is deprecated.


Builder for MediaItem.

Summary

Public constructors

Default constructor

Public functions

MediaItem

Build MediaItem.

MediaItem.Builder
setEndPosition(position: Long)

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

MediaItem.Builder

Set the metadata of this instance.

MediaItem.Builder

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

Public constructors

Builder

Added in 1.0.0
Deprecated in 1.3.0
Builder()

Default constructor

Public functions

build

Added in 1.0.0
Deprecated in 1.3.0
fun build(): MediaItem

Build MediaItem.

Returns
MediaItem

a new MediaItem.

setEndPosition

Added in 1.0.0
Deprecated in 1.3.0
fun setEndPosition(position: Long): MediaItem.Builder

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
MediaItem.Builder

this instance for chaining

setMetadata

Added in 1.0.0
Deprecated in 1.3.0
fun setMetadata(metadata: MediaMetadata?): MediaItem.Builder

Set the metadata of this instance. null for unset.

Parameters
metadata: MediaMetadata?

metadata

Returns
MediaItem.Builder

this instance for chaining

setStartPosition

Added in 1.0.0
Deprecated in 1.3.0
fun setStartPosition(position: Long): MediaItem.Builder

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
MediaItem.Builder

this instance for chaining