java.lang.Object | |
↳ | com.google.android.gms.cast.RemoteMediaPlayer |
Class for controlling a media player application running on a receiver.
Some operations, like loading of media or adjusting volume, can be tracked. The corresponding
methods return a PendingResult
for this purpose.
Nested Classes | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
RemoteMediaPlayer.MediaChannelResult | Result of a media command. | ||||||||||||||||||||||||||||||||
RemoteMediaPlayer.OnMetadataUpdatedListener | The listener interface for tracking metadata changes. | ||||||||||||||||||||||||||||||||
RemoteMediaPlayer.OnStatusUpdatedListener | The listener interface for tracking player status changes. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | RESUME_STATE_PAUSE | A resume state indicating that the player should be paused, regardless of its current state. | |||||||||
int | RESUME_STATE_PLAY | A resume state indicating that the player should be playing, regardless of its current state. | |||||||||
int | RESUME_STATE_UNCHANGED | A resume state indicating that the player state should be left unchanged. | |||||||||
int | STATUS_CANCELED | A status indicating that a request was canceled. | |||||||||
int | STATUS_FAILED | A status indicating that a request failed. | |||||||||
int | STATUS_REPLACED | A status indicating that the request's progress is no longer being tracked because another request of the same type has been made before the first request completed. | |||||||||
int | STATUS_SUCCEEDED | A status indicating that a request completed successfully. | |||||||||
int | STATUS_TIMED_OUT | A status indicating that a request has timed out. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the approximate stream position as calculated from the last received stream
information and the elapsed wall-time since that update.
| |||||||||||
Returns the current media information, if any.
| |||||||||||
Returns the current media status, if any.
| |||||||||||
Returns the media control namespace.
| |||||||||||
Convenience method for getting the stream duration.
| |||||||||||
Loads and optionally starts playback of a new media item.
| |||||||||||
Loads and automatically starts playback of a new media item.
| |||||||||||
Loads and optionally starts playback of a new media item.
| |||||||||||
Loads and optionally starts playback of a new media item.
| |||||||||||
Called when a message is received from a given
CastDevice . | |||||||||||
Pauses playback of the current media item.
| |||||||||||
Pauses playback of the current media item.
| |||||||||||
Begins (or resumes) playback of the current media item.
| |||||||||||
Begins (or resumes) playback of the current media item.
| |||||||||||
Requests updated media status information from the receiver.
| |||||||||||
Seeks to a new position within the current media item.
| |||||||||||
Seeks to a new position within the current media item.
| |||||||||||
Seeks to a new position within the current media item.
| |||||||||||
Sets the
RemoteMediaPlayer.OnMetadataUpdatedListener to get metadata updates. | |||||||||||
Sets the
RemoteMediaPlayer.OnStatusUpdatedListener to get status updates. | |||||||||||
Toggles the stream muting.
| |||||||||||
Toggles the stream muting.
| |||||||||||
Sets the stream volume.
| |||||||||||
Sets the stream volume of the current media item.
| |||||||||||
Stops playback of the current media item.
| |||||||||||
Stops playback of the current media item.
|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||||||||||||||||||||||||
![]()
|
A resume state indicating that the player should be paused, regardless of its current state.
A resume state indicating that the player should be playing, regardless of its current state.
A resume state indicating that the player state should be left unchanged.
A status indicating that a request was canceled.
A status indicating that a request failed.
A status indicating that the request's progress is no longer being tracked because another request of the same type has been made before the first request completed. This applies to requests such as volume change, where a new request invalidates the results of a previous one.
A status indicating that a request completed successfully.
A status indicating that a request has timed out.
Returns the approximate stream position as calculated from the last received stream information and the elapsed wall-time since that update.
Returns the media control namespace.
Convenience method for getting the stream duration.
Loads and optionally starts playback of a new media item.
apiClient | The API client to perform the operation with. |
---|---|
mediaInfo | An object describing the media item to load. |
autoplay | Whether playback should start immediately. |
PendingResult
which can be used to track the progress of the request.
Loads and automatically starts playback of a new media item.
apiClient | The API client to perform the operation with. |
---|---|
mediaInfo | An object describing the media item to load. |
PendingResult
which can be used to track the progress of the request.
Loads and optionally starts playback of a new media item. The media item starts playback at
playPosition
.
apiClient | The API client to perform the operation with. |
---|---|
mediaInfo | An object describing the media item to load. |
autoplay | Whether playback should start immediately. |
playPosition | The initial playback position, in milliseconds from the beginning of the stream. |
PendingResult
which can be used to track the progress of the request.
Loads and optionally starts playback of a new media item. The media item starts playback at
playPosition
. This method optionally sends custom data as a JSONObject
with the load request.
apiClient | The API client to perform the operation with. |
---|---|
mediaInfo | An object describing the media item to load. |
autoplay | Whether playback should start immediately. |
playPosition | The initial playback position, in milliseconds from the beginning of the stream. |
customData | Custom application-specific data to pass along with the request. |
PendingResult
which can be used to track the progress of the request.
Called when a message is received from a given CastDevice
.
castDevice | The castDevice from whence the message originated. |
---|---|
namespace | The namespace of the received message. |
message | The received payload for the message. |
Pauses playback of the current media item.
apiClient | The API client to perform the operation with. |
---|
PendingResult
which can be used to track the progress of the request.
Pauses playback of the current media item.
apiClient | The API client to perform the operation with. |
---|---|
customData | Custom application-specific data to pass along with the request. |
PendingResult
which can be used to track the progress of the request.
Begins (or resumes) playback of the current media item.
apiClient | The API client to perform the operation with. |
---|---|
customData | Custom application-specific data to pass along with the request. |
PendingResult
which can be used to track the progress of the request.
Begins (or resumes) playback of the current media item.
apiClient | The API client to perform the operation with. |
---|
PendingResult
which can be used to track the progress of the request.
Requests updated media status information from the receiver. RemoteMediaPlayer.OnStatusUpdatedListener
callback will be triggered, when the updated media status has been received. This will also
update the internal state of the RemoteMediaPlayer
object with the current state of
the receiver, including the current session ID. This method should be called when joining an
application that supports the media control namespace.
apiClient | The API client to perform the operation with. |
---|
PendingResult
which can be used to track the progress of the request.
Seeks to a new position within the current media item.
apiClient | The API client to perform the operation with. |
---|---|
position | The new position, in milliseconds from the beginning of the stream. |
PendingResult
which can be used to track the progress of the request.
Seeks to a new position within the current media item.
apiClient | The API client to perform the operation with. |
---|---|
position | The new position, in milliseconds from the beginning of the stream. |
resumeState | The action to take after the seek operation has finished. |
customData | Custom application-specific data to pass along with the request. |
PendingResult
which can be used to track the progress of the request.
Seeks to a new position within the current media item.
apiClient | The API client to perform the operation with. |
---|---|
position | The new position, in milliseconds from the beginning of the stream. |
resumeState | The action to take after the seek operation has finished. |
PendingResult
which can be used to track the progress of the request.
Sets the RemoteMediaPlayer.OnMetadataUpdatedListener
to get metadata updates.
Sets the RemoteMediaPlayer.OnStatusUpdatedListener
to get status updates.
Toggles the stream muting.
apiClient | The API client to perform the operation with. |
---|---|
muteState | Whether the stream should be muted or unmuted. |
customData | Custom application-specific data to pass along with the request. |
PendingResult
which can be used to track the progress of the request.
Toggles the stream muting.
apiClient | The API client to perform the operation with. |
---|---|
muteState | Whether the stream should be muted or unmuted. |
PendingResult
which can be used to track the progress of the request.
Sets the stream volume. If volume
is outside of the range [0.0, 1.0], then the value
will be clipped.
apiClient | The API client to perform the operation with. |
---|---|
volume | The new volume, in the range [0.0 - 1.0]. |
customData | Custom application-specific data to pass along with the request. |
PendingResult
which can be used to track the progress of the request.IllegalArgumentException | If the volume is infinity or NaN. |
---|
Sets the stream volume of the current media item. When the stream volume has been updated,
onStatusUpdated()
will be called.
apiClient | The API client to perform the operation with. |
---|---|
volume | The new volume, in the range [0.0 - 1.0]. |
PendingResult
which can be used to track the progress of the request.IllegalArgumentException | If the volume is infinity or NaN. |
---|
Stops playback of the current media item.
apiClient | The API client to perform the operation with. |
---|
PendingResult
which can be used to track the progress of the request.
Stops playback of the current media item.
apiClient | The API client to perform the operation with. |
---|---|
customData | Custom application-specific data to pass along with the request. |
PendingResult
which can be used to track the progress of the request.