MediaStatus | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Constants | Methods | Inherited Methods | [Expand All]
public final class

# MediaStatus

extends Object

java.lang.Object
↳ | com.google.android.gms.cast.MediaStatus

## Class Overview

A class that holds status information about some media. The current `MediaStatus` can be obtained from the `RemoteMediaPlayer`.

## Summary

Constants
long | COMMAND_PAUSE | A flag (bitmask) indicating that a media item can be paused.
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_BACKWARD | A flag (bitmask) indicating that a media item supports skipping backward.
long | COMMAND_SKIP_FORWARD | A flag (bitmask) indicating that a media item supports skipping forward.
long | COMMAND_TOGGLE_MUTE | A flag (bitmask) indicating that a media item's audio can be muted.
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_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.

Public Methods
long[] | getActiveTrackIds() Returns the list of active track IDs, if any, otherwise `null`.
JSONObject | getCustomData() Returns any custom data that is associated with the media item.
int | getIdleReason() Gets the player state idle reason.
MediaInfo | getMediaInfo() Returns the `MediaInfo` for this item.
double | getPlaybackRate() Gets the current stream playback rate.
int | getPlayerState() Gets the current media player state.
long | getStreamPosition() Returns the current stream position, in milliseconds.
double | getStreamVolume() Returns the stream's volume.
boolean | isMediaCommandSupported(long mediaCommand) Tests if the stream supports a given control command.
boolean | isMute() Returns the stream's mute state.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## Constants

#### public static final long COMMAND_PAUSE

A flag (bitmask) indicating that a media item can be paused.

Constant Value: 1 (0x0000000000000001)

#### public static final long COMMAND_SEEK

A flag (bitmask) indicating that a media item supports seeking.

Constant Value: 2 (0x0000000000000002)

#### public static final long COMMAND_SET_VOLUME

A flag (bitmask) indicating that a media item's audio volume can be changed.

Constant Value: 4 (0x0000000000000004)

#### public static final long COMMAND_SKIP_BACKWARD

A flag (bitmask) indicating that a media item supports skipping backward.

Constant Value: 32 (0x0000000000000020)

#### public static final long COMMAND_SKIP_FORWARD

A flag (bitmask) indicating that a media item supports skipping forward.

Constant Value: 16 (0x0000000000000010)

#### public static final long COMMAND_TOGGLE_MUTE

A flag (bitmask) indicating that a media item's audio can be muted.

Constant Value: 8 (0x0000000000000008)

#### public static final int IDLE_REASON_CANCELED

Constant indicating that the player is idle because playback has been canceled in response to a STOP command.

Constant Value: 2 (0x00000002)

#### public static final int IDLE_REASON_ERROR

Constant indicating that the player is idle because a playback error has occurred.

Constant Value: 4 (0x00000004)

#### public static final int IDLE_REASON_FINISHED

Constant indicating that the player is idle because playback has finished.

Constant Value: 1 (0x00000001)

#### public static final int IDLE_REASON_INTERRUPTED

Constant indicating that the player is idle because playback has been interrupted by a LOAD command.

Constant Value: 3 (0x00000003)

#### public static final int IDLE_REASON_NONE

Constant indicating that the player currently has no idle reason.

Constant Value: 0 (0x00000000)

#### public static final int PLAYER_STATE_BUFFERING

Constant indicating that the media player is buffering.

Constant Value: 4 (0x00000004)

#### public static final int PLAYER_STATE_IDLE

Constant indicating that the media player is idle.

Constant Value: 1 (0x00000001)

#### public static final int PLAYER_STATE_PAUSED

Constant indicating that the media player is paused.

Constant Value: 3 (0x00000003)

#### public static final int PLAYER_STATE_PLAYING

Constant indicating that the media player is playing.

Constant Value: 2 (0x00000002)

#### public static final int PLAYER_STATE_UNKNOWN

Constant indicating unknown player state.

Constant Value: 0 (0x00000000)

## Public Methods

#### public long[] getActiveTrackIds ()

Returns the list of active track IDs, if any, otherwise `null`.

#### public JSONObject getCustomData ()

Returns any custom data that is associated with the media item.

#### public int getIdleReason ()

Gets the player state idle reason. This value is only meaningful if the player state is in fact `PLAYER_STATE_IDLE`.

#### public MediaInfo getMediaInfo ()

Returns the `MediaInfo` for this item.

#### public double getPlaybackRate ()

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 postive value if the stream is seeking forwards.

#### public int getPlayerState ()

Gets the current media player state.

#### public long getStreamPosition ()

Returns the current stream position, in milliseconds.

#### public double getStreamVolume ()

Returns the stream's volume.

#### public boolean isMediaCommandSupported (long mediaCommand)

Tests if the stream supports a given control command.

##### Parameters

mediaCommand | The media command.

##### Returns

- `true` if the command is supported, `false` otherwise.

#### public boolean isMute ()

Returns the stream's mute state.