FileMediaItem

Added in 1.0.0
Deprecated in 1.3.0

public class FileMediaItem extends MediaItem


Structure for media item for a file.

Users should use Builder to create FileMediaItem.

You cannot directly send this object across the process through ParcelUtils. See MediaItem for detail.

See also
MediaItem

Summary

Nested types

public final class FileMediaItem.Builder extends MediaItem.Builder

This class is deprecated.

androidx.media2 is deprecated.

Constants

static final long
FD_LENGTH_UNKNOWN = 576460752303423487

Used when the length of file descriptor is unknown.

Public methods

long

Returns the content length associated with the ParcelFileDescriptor of this media item.

long

Returns the offset associated with the ParcelFileDescriptor of this media item.

@NonNull ParcelFileDescriptor

Returns the ParcelFileDescriptor of this media item.

Inherited Constants

From androidx.media2.common.MediaItem
static final long
POSITION_UNKNOWN = 576460752303423487

Used when a position is unknown.

Inherited methods

From androidx.media2.common.MediaItem
long

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

@Nullable MediaMetadata

Gets the metadata of the media.

long

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

void

Sets metadata.

String

Constants

FD_LENGTH_UNKNOWN

Added in 1.0.0
Deprecated in 1.3.0
public static final long FD_LENGTH_UNKNOWN = 576460752303423487

Used when the length of file descriptor is unknown.

Public methods

getFileDescriptorLength

Added in 1.0.0
Deprecated in 1.3.0
public long getFileDescriptorLength()

Returns the content length associated with the ParcelFileDescriptor of this media item. FD_LENGTH_UNKNOWN means same as the length of source content.

Returns
long

the content length associated with the ParcelFileDescriptor of this media item

getFileDescriptorOffset

Added in 1.0.0
Deprecated in 1.3.0
public long getFileDescriptorOffset()

Returns the offset associated with the ParcelFileDescriptor of this media item. It's meaningful only when it has been set by the MediaItem.Builder.

Returns
long

the offset associated with the ParcelFileDescriptor of this media item

getParcelFileDescriptor

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull ParcelFileDescriptor getParcelFileDescriptor()

Returns the ParcelFileDescriptor of this media item.

Returns
@NonNull ParcelFileDescriptor

the ParcelFileDescriptor of this media item