belongs to Maven artifact androidx.media2:media2:1.0.0-alpha01

MediaItem2.Builder

public static final class MediaItem2.Builder
extends Object

java.lang.Object
   ↳ androidx.media2.MediaItem2.Builder


Builder for MediaItem2

Summary

Public constructors

MediaItem2.Builder(int flags)

Constructor for MediaItem2.Builder

Public methods

MediaItem2 build()

Build MediaItem2.

MediaItem2.Builder setDataSourceDesc(DataSourceDesc2 dataSourceDesc)

Set the data source descriptor for this instance.

MediaItem2.Builder setMediaId(String mediaId)

Set the media id of this instance.

MediaItem2.Builder setMetadata(MediaMetadata2 metadata)

Set the metadata of this instance.

Inherited methods

Public constructors

MediaItem2.Builder

public MediaItem2.Builder (int flags)

Constructor for MediaItem2.Builder

Public methods

build

public MediaItem2 build ()

Build MediaItem2.

Returns
MediaItem2 a new MediaItem2.

setDataSourceDesc

public MediaItem2.Builder setDataSourceDesc (DataSourceDesc2 dataSourceDesc)

Set the data source descriptor for this instance. null for unset.

Parameters
dataSourceDesc DataSourceDesc2: data source descriptor

Returns
MediaItem2.Builder this instance for chaining

setMediaId

public MediaItem2.Builder setMediaId (String mediaId)

Set the media id of this instance. null for unset.

If used, this should be a persistent unique key for the underlying content so session and controller can uniquely identify a media content.

If the metadata is set with the setMetadata(MediaMetadata2) and it has media id, id from setMediaId(String) will be ignored and metadata's id will be used instead.

Parameters
mediaId String: media id

Returns
MediaItem2.Builder this instance for chaining

setMetadata

public MediaItem2.Builder setMetadata (MediaMetadata2 metadata)

Set the metadata of this instance. null for unset.

If the metadata is set with the setMetadata(MediaMetadata2) and it has media id, id from setMediaId(String) will be ignored and metadata's id will be used instead.

Parameters
metadata MediaMetadata2: metadata

Returns
MediaItem2.Builder this instance for chaining