belongs to Maven artifact com.android.support:mediarouter-v7:28.0.0-alpha1
MediaItemStatus
public
final
class
MediaItemStatus
extends Object
java.lang.Object | |
↳ | android.support.v7.media.MediaItemStatus |
Describes the playback status of a media item.
This class is part of the remote playback protocol described by the
MediaControlIntent
class.
As a media item is played, it transitions through a sequence of states including:
pending
, buffering
,
playing
, paused
,
finished
, canceled
,
invalidated
, and
error
. Refer to the documentation of each state
for an explanation of its meaning.
While the item is playing, the playback status may also include progress information
about the content position
and
content duration
although not all route destinations
will report it.
To monitor playback status, the application should supply a PendingIntent
to use as the
item status update receiver
for a given playback request
. Note that
the status update receiver will only be invoked for major status changes such as a
transition from playing to finished.
The status update receiver will not be invoked for minor progress updates such as
changes to playback position or duration. If the application wants to monitor
playback progress, then it must use the
get status request
to poll for changes
periodically and estimate the playback position while playing. Note that there may
be a significant power impact to polling so the application is advised only
to poll when the screen is on and never more than about once every 5 seconds or so.
This object is immutable once created using a MediaItemStatus.Builder
instance.
Summary
Nested classes | |
---|---|
class |
MediaItemStatus.Builder
Builder for |
Constants | |
---|---|
String |
EXTRA_HTTP_RESPONSE_HEADERS
Bundle extra: HTTP response headers. |
String |
EXTRA_HTTP_STATUS_CODE
Integer extra: HTTP status code. |
int |
PLAYBACK_STATE_BUFFERING
Playback state: Buffering or seeking to a new position. |
int |
PLAYBACK_STATE_CANCELED
Playback state: Canceled. |
int |
PLAYBACK_STATE_ERROR
Playback state: Playback halted or aborted due to an error. |
int |
PLAYBACK_STATE_FINISHED
Playback state: Finished. |
int |
PLAYBACK_STATE_INVALIDATED
Playback state: Invalidated. |
int |
PLAYBACK_STATE_PAUSED
Playback state: Paused. |
int |
PLAYBACK_STATE_PENDING
Playback state: Pending. |
int |
PLAYBACK_STATE_PLAYING
Playback state: Playing. |
Public methods | |
---|---|
Bundle
|
asBundle()
Converts this object to a bundle for serialization. |
static
MediaItemStatus
|
fromBundle(Bundle bundle)
Creates an instance from a bundle. |
long
|
getContentDuration()
Gets the total duration of the content to be played as a long integer number of milliseconds. |
long
|
|