public final class

CallbackMediaItem.Builder

extends MediaItem.Builder

 java.lang.Object

androidx.media2.common.MediaItem.Builder

↳androidx.media2.common.CallbackMediaItem.Builder

Overview

This Builder class simplifies the creation of a CallbackMediaItem object.

Summary

Constructors
publicBuilder(DataSourceCallback dsc2)

Creates a new Builder object.

Methods
public CallbackMediaItembuild()

public MediaItem.BuildersetEndPosition(long position)

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

public MediaItem.BuildersetMetadata(MediaMetadata metadata)

Set the metadata of this instance.

public MediaItem.BuildersetStartPosition(long position)

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

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(DataSourceCallback dsc2)

Creates a new Builder object.

Parameters:

dsc2: the DataSourceCallback for the media you want to play

Methods

public MediaItem.Builder setMetadata(MediaMetadata metadata)

Set the metadata of this instance. null for unset.

Parameters:

metadata: metadata

Returns:

this instance for chaining

public MediaItem.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: the start position in milliseconds at which the playback will start

Returns:

this instance for chaining

public MediaItem.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: the end position in milliseconds at which the playback will end

Returns:

this instance for chaining

public CallbackMediaItem build()

Returns:

A new CallbackMediaItem with values supplied by the Builder.