public final class

FileMediaItem.Builder

extends MediaItem.BuilderBase<FileMediaItem.Builder>

 java.lang.Object

androidx.media2.MediaItem.BuilderBase<FileMediaItem.Builder>

↳androidx.media2.FileMediaItem.Builder

Overview

This Builder class simplifies the creation of a FileMediaItem object.

Summary

Constructors
publicBuilder(java.io.FileDescriptor fd)

Creates a new Builder object with a media item (FileDescriptor) to use.

publicBuilder(java.io.FileDescriptor fd, long offset, long length)

Creates a new Builder object with a media item (FileDescriptor) to use.

Methods
public FileMediaItembuild()

from MediaItem.BuilderBase<T>setEndPosition, setMetadata, setStartPosition
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(java.io.FileDescriptor fd)

Creates a new Builder object with a media item (FileDescriptor) to use. The FileDescriptor must be seekable (N.B. a LocalSocket is not seekable). It is the caller's responsibility to close the file descriptor after the source has been used.

Parameters:

fd: the FileDescriptor for the file you want to play

public Builder(java.io.FileDescriptor fd, long offset, long length)

Creates a new Builder object with a media item (FileDescriptor) to use. The FileDescriptor must be seekable (N.B. a LocalSocket is not seekable). It is the caller's responsibility to close the file descriptor after the source has been used. Any negative number for offset is treated as 0. Any negative number for length is treated as maximum length of the media item.

Parameters:

fd: the FileDescriptor for the file you want to play
offset: the offset into the file where the data to be played starts, in bytes
length: the length in bytes of the data to be played

Methods

public FileMediaItem build()

Returns:

A new FileMediaItem with values supplied by the Builder.