A class that holds status information about some media or media queue. The current
MediaStatus can
be obtained from the RemoteMediaPlayer.
Each media session is associated with a media queue on the receiver application. The list
of media items in the current queue as maintained by the receiver can be obtained from
getQueueItems().
Media items are assigned a unique item ID. Accessors for individual item and values of
properties of the queue are also provided here.
getCurrentItemId(),
getLoadingItemId()
and getPreloadedItemId()
tells which item is playing, which item is loading and which item has been preloaded on the
receiver.
| long | COMMAND_DISLIKE | A flag (bitmask) indicating that dislike is supported. |
| long | COMMAND_EDIT_TRACKS | A flag (bitmask) indicating that edit tracks is supported. |
| long | COMMAND_FOLLOW | A flag (bitmask) indicating that follow is supported. |
| long | COMMAND_LIKE | A flag (bitmask) indicating that like is supported. |
| long | COMMAND_PAUSE | A flag (bitmask) indicating that a media item can be paused. |
| long | COMMAND_PLAYBACK_RATE | A flag (bitmask) indicating that set playback rate is supported. |
| long | COMMAND_QUEUE_NEXT | A flag (bitmask) indicating that a media item supports queuing next. |
| long | COMMAND_QUEUE_PREVIOUS | A flag (bitmask) indicating that a media item supports queuing previous. |
| long | COMMAND_QUEUE_REPEAT | A flag (bitmask) indicating that queue repeat (repeat all and repeat one) is supported. |
| long | COMMAND_QUEUE_REPEAT_ALL | A flag (bitmask) indicating that queue repeat all is supported. |
| long | COMMAND_QUEUE_REPEAT_ONE | A flag (bitmask) indicating that queue repeat one is supported. |
| long | COMMAND_QUEUE_SHUFFLE | A flag (bitmask) indicating that queue shuffle is supported. |
| long | COMMAND_SEEK | A flag (bitmask) indicating that a media item supports seeking. |
| long | COMMAND_SET_VOLUME | A flag (bitmask) indicating that a media item's audio volume can be changed. |
| long | COMMAND_SKIP_AD | A flag (bitmask) indicating that skip ad is supported. |
| long | COMMAND_SKIP_BACKWARD | This constant is deprecated. Use
COMMAND_QUEUE_PREVIOUS instead. |
| long | COMMAND_SKIP_FORWARD | This constant is deprecated. Use
COMMAND_QUEUE_NEXT
instead. |
| long | COMMAND_TOGGLE_MUTE | A flag (bitmask) indicating that a media item's audio can be muted. |
| long | COMMAND_UNFOLLOW | A flag (bitmask) indicating that unfollow is supported. |
| int | IDLE_REASON_CANCELED | Constant indicating that the player is idle because playback has been canceled in response to a STOP command. |
| int | IDLE_REASON_ERROR | Constant indicating that the player is idle because a playback error has occurred. |
| int | IDLE_REASON_FINISHED | Constant indicating that the player is idle because playback has finished. |
| int | IDLE_REASON_INTERRUPTED | Constant indicating that the player is idle because playback has been interrupted by a LOAD command. |
| int | IDLE_REASON_NONE | Constant indicating that the player currently has no idle reason. |
| int | PLAYER_STATE_BUFFERING | Constant indicating that the media player is buffering. |
| int | PLAYER_STATE_IDLE | Constant indicating that the media player is idle. |
| int | PLAYER_STATE_LOADING | Constant indicating that the media player is loading. |
| int | PLAYER_STATE_PAUSED | Constant indicating that the media player is paused. |
| int | PLAYER_STATE_PLAYING | Constant indicating that the media player is playing. |
| int | PLAYER_STATE_UNKNOWN | Constant indicating unknown player state. |
| int | REPEAT_MODE_REPEAT_ALL | Constant indicating that the items in the queue will be played indefinitely. |
| int | REPEAT_MODE_REPEAT_ALL_AND_SHUFFLE | Constant indicating that the items in the queue will be played indefinitely, and the order of the items will be randomly shuffled once the last item in the queue finishes. |
| int | REPEAT_MODE_REPEAT_OFF | Constant indicating that when the queue is completed the media session is terminated. |
| int | REPEAT_MODE_REPEAT_SINGLE | Constant indicating that the current item will be repeated indefinitely. |
| boolean | |
| long[] |
getActiveTrackIds()
Returns the list of active track IDs set by the cast receiver, if any,
otherwise
null.
|
| AdBreakStatus |
getAdBreakStatus()
Returns the received
AdBreakStatus.
|
| AdBreakInfo |
getCurrentAdBreak()
Returns the
AdBreakInfo
of the currently playing ad break on the cast receiver.
|
| AdBreakClipInfo |
getCurrentAdBreakClip()
Returns the
AdBreakClipInfo
of the currently playing ad break clip on the cast receiver.
|
| int |
getCurrentItemId()
Returns the item ID of the item that that was active in the queue (it may not
be playing) at the time the media status change happened.
|
| JSONObject |
getCustomData()
Returns any custom data that is associated with the media item.
|
| int |
getIdleReason()
Gets the player state idle reason.
|
| Integer |
getIndexById(int itemId)
Returns the index of the
MediaQueueItem
with the given itemId in the playback queue, or null
if there is no such item in the queue.
|
| MediaQueueItem |
getItemById(int itemId)
Returns the
MediaQueueItem
of the give item ID.
|
| MediaQueueItem |
getItemByIndex(int index)
Returns the
MediaQueueItem
at index, or null if index is out of bounds.
|
| MediaLiveSeekableRange |
getLiveSeekableRange()
Returns the seekable range of a live stream.
|
| int |
getLoadingItemId()
Returns the item ID of the item that is currently loading (but isn't active in
the queue) on the receiver.
|
| MediaInfo |
getMediaInfo()
Returns the
MediaInfo
for this item.
|
| double |
getPlaybackRate()
Gets the current stream playback rate.
|
| int |
getPlayerState()
Gets the current media
PlayerState.
|
| int |
getPreloadedItemId()
If the next item has been preloaded this returns the preloaded item ID.
|
| MediaQueueData |
getQueueData()
Returns the last received
MediaQueueData.
|
| MediaQueueItem |
getQueueItem(int index)
Returns the
MediaQueueItem
at index, or null if index out of bounds.
|
| MediaQueueItem |
getQueueItemById(int itemId)
Returns the
MediaQueueItem
of the give item ID.
|
| int |
getQueueItemCount()
Returns the number of items in the media queue.
|
| List<MediaQueueItem> |
getQueueItems()
Returns the list of
MediaQueueItem
representing the queue as maintained by the receiver as an unmodifiable list.
|
| int |
getQueueRepeatMode()
Returns the repeat mode of the media queue.
|
| long |
getStreamPosition()
Returns the current stream position, in milliseconds.
|
| double |
getStreamVolume()
Returns the stream's volume.
|
| VideoInfo |
getVideoInfo()
Returns the last received
VideoInfo.
|
| int |
hashCode()
|
| boolean |
isMediaCommandSupported(long mediaCommand)
Tests if the stream supports a given control command.
|
| boolean |
isMute()
Returns the stream's mute state.
|
| boolean |
isPlayingAd()
Returns
true is the receiver is playing an ad.
|
| void |
writeToParcel(Parcel out, int
flags)
|
A flag (bitmask) indicating that dislike is supported.
A flag (bitmask) indicating that edit tracks is supported.
A flag (bitmask) indicating that follow is supported.
A flag (bitmask) indicating that like is supported.
A flag (bitmask) indicating that a media item can be paused.
A flag (bitmask) indicating that set playback rate is supported.
A flag (bitmask) indicating that a media item supports queuing next.
A flag (bitmask) indicating that a media item supports queuing previous.
A flag (bitmask) indicating that queue repeat (repeat all and repeat one) is supported.
A flag (bitmask) indicating that queue repeat all is supported.
A flag (bitmask) indicating that queue repeat one is supported.
A flag (bitmask) indicating that queue shuffle is supported.
A flag (bitmask) indicating that a media item supports seeking.
A flag (bitmask) indicating that a media item's audio volume can be changed.
A flag (bitmask) indicating that skip ad is supported.
This constant is deprecated.
Use COMMAND_QUEUE_PREVIOUS
instead.
This constant is deprecated.
Use COMMAND_QUEUE_NEXT
instead.
A flag (bitmask) indicating that a media item's audio can be muted.
A flag (bitmask) indicating that unfollow is supported.
Constant indicating that the player is idle because playback has been canceled in response to a STOP command.
Constant indicating that the player is idle because a playback error has occurred.
Constant indicating that the player is idle because playback has finished.
Constant indicating that the player is idle because playback has been interrupted by a LOAD command.
Constant indicating that the player currently has no idle reason.
Constant indicating that the media player is buffering.
Constant indicating that the media player is idle. The idle reason can be determined
by getIdleReason().
Constant indicating that the media player is loading.
Constant indicating that the media player is paused.
Constant indicating that the media player is playing.
Constant indicating unknown player state.
Constant indicating that the items in the queue will be played indefinitely.
Constant indicating that the items in the queue will be played indefinitely, and the order of the items will be randomly shuffled once the last item in the queue finishes. The queue will continue to play starting from the first item of the shuffled items.
Constant indicating that when the queue is completed the media session is terminated.
Constant indicating that the current item will be repeated indefinitely.
Returns the list of active track IDs set by the cast receiver, if any, otherwise
null.
Returns the received AdBreakStatus.
Returns the AdBreakInfo
of the currently playing ad break on the cast receiver. If the cast receiver is not
playing an ad break, null will be returned.
Returns the AdBreakClipInfo
of the currently playing ad break clip on the cast receiver. If the cast receiver is
not playing an ad break clip, null will be returned.
Returns the item ID of the item that that was active in the queue (it may not be playing) at the time the media status change happened.
Returns any custom data that is associated with the media item.
Gets the player state idle reason. This value is only meaningful if the player state
is in fact PLAYER_STATE_IDLE.
Returns the index of the MediaQueueItem
with the given itemId in the playback queue, or null if there
is no such item in the queue.
Returns the MediaQueueItem
of the give item ID. Returns null if not found.
Returns the MediaQueueItem
at index, or null if index is out of bounds.
Returns the seekable range of a live stream. If the current media is live stream and
this method returns null, then the stream is not seekable.
Returns the item ID of the item that is currently loading (but isn't active in the
queue) on the receiver. Returns MediaQueueItem.INVALID_ITEM_ID
if no item is currently loading.
Gets the current stream playback rate. This will be negative if the stream is seeking backwards, 0 if the stream is paused, 1 if the stream is playing normally, and some other positive value if the stream is seeking forwards.
Gets the current media
PlayerState. The media player state is retrieved from the receiver.
If the next item has been preloaded this returns the preloaded item ID. Otherwise
returns MediaQueueItem.INVALID_ITEM_ID.
Returns the last received MediaQueueData.
Returns the MediaQueueItem
at index, or null if index out of bounds.
Returns the MediaQueueItem
of the give item ID. Returns null if not found.
Returns the number of items in the media queue.
Returns the list of MediaQueueItem
representing the queue as maintained by the receiver as an unmodifiable list.
Returns the repeat mode of the media queue.
Returns the current stream position, in milliseconds.
Returns the stream's volume.
Returns the last received VideoInfo.
If the video information of the current media was not received from the cast receiver,
null will be returned.
Tests if the stream supports a given control command.
| mediaCommand | The media command. |
|---|
true if the command is supported, false otherwise.Returns the stream's mute state.
Returns true is the receiver is playing an ad.