FileMediaItem.Builder
public
static
final
class
FileMediaItem.Builder
extends Object
| java.lang.Object | |
| ↳ | androidx.media2.FileMediaItem.Builder |
This Builder class simplifies the creation of a FileMediaItem object.
Summary
Public constructors | |
|---|---|
FileMediaItem.Builder(FileDescriptor fd)
Creates a new Builder object with a media item (FileDescriptor) to use. |
|
FileMediaItem.Builder(FileDescriptor fd, long offset, long length)
Creates a new Builder object with a media item (FileDescriptor) to use. |
|
Public methods | |
|---|---|
FileMediaItem
|
build()
Build |
T extends BuilderBase
|
setEndPosition(long position)
Sets the end position in milliseconds at which the playback will end. |
T extends BuilderBase
|
setMetadata(MediaMetadata metadata)
Set the metadata of this instance. |
T extends BuilderBase
|
setStartPosition(long position)
Sets the start position in milliseconds at which the playback will start. |
Inherited methods | |
|---|---|
Public constructors
FileMediaItem.Builder
public FileMediaItem.Builder (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 |
FileDescriptor: the FileDescriptor for the file you want to play
|
FileMediaItem.Builder
public FileMediaItem.Builder (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 |
FileDescriptor: the FileDescriptor for the file you want to play |
offset |
long: the offset into the file where the data to be played starts, in bytes |
length |
long: the length in bytes of the data to be played
|
Public methods
build
public FileMediaItem build ()
Build MediaItem.
| Returns | |
|---|---|
FileMediaItem |
A new FileMediaItem with values supplied by the Builder. |
setEndPosition
public T extends BuilderBase 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 |
long: the end position in milliseconds at which the playback will end |
| Returns | |
|---|---|
T extends BuilderBase |
the same Builder instance. |
setMetadata
public T extends BuilderBase setMetadata (MediaMetadata metadata)
Set the metadata of this instance. null for unset.
| Parameters | |
|---|---|
metadata |
MediaMetadata: metadata |
| Returns | |
|---|---|
T extends BuilderBase |
this instance for chaining |
setStartPosition
public T extends BuilderBase setStartPosition (long position)
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 | |
|---|---|
T extends BuilderBase |
the same Builder instance. |
Interfaces
Classes
- CallbackMediaItem
- CallbackMediaItem.Builder
- DataSourceCallback
- FileMediaItem
- FileMediaItem.Builder
- HeartRating
- MediaBrowser
- MediaBrowser.BrowserCallback
- MediaBrowser.BrowserResult
- MediaController
- MediaController.ControllerCallback
- MediaController.ControllerResult
- MediaController.PlaybackInfo
- MediaItem
- MediaItem.Builder
- MediaLibraryService
- MediaLibraryService.LibraryParams
- MediaLibraryService.LibraryParams.Builder
- MediaLibraryService.LibraryResult
- MediaLibraryService.MediaLibrarySession
- MediaLibraryService.MediaLibrarySession.Builder
- MediaLibraryService.MediaLibrarySession.MediaLibrarySessionCallback
- MediaMetadata
- MediaMetadata.Builder
- MediaPlayer
- MediaPlayer.PlayerCallback
- MediaPlayer.TrackInfo
- MediaSession
- MediaSession.Builder
- MediaSession.CommandButton
- MediaSession.CommandButton.Builder
- MediaSession.ControllerInfo
- MediaSession.SessionCallback
- MediaSession.SessionResult
- MediaSessionManager
- MediaSessionService
- MediaSessionService.MediaNotification
- MediaTimestamp
- PercentageRating
- PlaybackParams
- PlaybackParams.Builder
- SessionCommand
- SessionCommandGroup
- SessionCommandGroup.Builder
- SessionPlayer
- SessionPlayer.PlayerCallback
- SessionPlayer.PlayerResult
- SessionToken
- StarRating
- SubtitleData
- ThumbRating
- TimedMetaData
- UriMediaItem
- UriMediaItem.Builder
- VideoSize