| java.lang.Object | ||
| ↳ | com.google.android.gms.cast.framework.Session | |
| ↳ | com.google.android.gms.cast.framework.CastSession | |
An implementation of Session for managing connections to a Cast receiver device. An
instance of CastSession is automatically created by the SessionManager when the
user selects a Cast device from the media route controller dialog. The current active
CastSession can be accessed by getCurrentCastSession().
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Adds the
Cast.Listener for Cast events, such as change of the application status and
change of device volume. | |||||||||||
Returns the device's active-input state.
| |||||||||||
Returns the metadata for the currently running receiver application, or
null if the
metadata is unavailable. | |||||||||||
Returns the current receiver application status, if any.
| |||||||||||
Returns the connecting or connected
CastDevice, or null if the session is
disconnecting or disconnected. | |||||||||||
Returns the
RemoteMediaClient for remote media control. | |||||||||||
Returns the amount of time that this
CastSession instance should still be considered
live by the SDK. | |||||||||||
Returns the device's standby state.
| |||||||||||
Returns the device's volume, in the range [0.0, 1.0].
| |||||||||||
Returns the device's mute state.
| |||||||||||
Removes the
Cast.Listener. | |||||||||||
Removes the
Cast.MessageReceivedCallback from this session for a given namespace. | |||||||||||
Requests the receiver's current status.
| |||||||||||
Sends a message to the currently connected application.
| |||||||||||
Sets the new
Cast.MessageReceivedCallback listener on this session for a given
namespace. | |||||||||||
Mutes or unmutes the device's audio.
| |||||||||||
Sets the device volume.
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Ends the
CastSession. | |||||||||||
Resumes the
CastSession. | |||||||||||
Starts the
CastSession. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.android.gms.cast.framework.Session
| |||||||||||
From class
java.lang.Object
| |||||||||||
Adds the Cast.Listener for Cast events, such as change of the application status and
change of device volume.
Returns the device's active-input state. The returned value is
ACTIVE_INPUT_STATE_YES, ACTIVE_INPUT_STATE_NO, or
ACTIVE_INPUT_STATE_UNKNOWN.
| IllegalStateException | If there is no active service connection. |
|---|
Returns the metadata for the currently running receiver application, or null if the
metadata is unavailable.
| IllegalStateException | If there is no active service connection. |
|---|
Returns the current receiver application status, if any. Message text is localized to the Google Cast device's locale.
| IllegalStateException | If there is no active service connection. |
|---|
Returns the connecting or connected CastDevice, or null if the session is
disconnecting or disconnected.
Returns the RemoteMediaClient for remote media control.
Returns the amount of time that this CastSession instance should still be considered
live by the SDK.
This method should be called only by the SDK.
Returns the device's standby state. The returned value is
STANDBY_STATE_UNKNOWN, STANDBY_STATE_NO, or
STANDBY_STATE_YES.
| IllegalStateException | If there is no active service connection. |
|---|
Returns the device's volume, in the range [0.0, 1.0].
| IllegalStateException | If there is no active service connection. |
|---|
Returns the device's mute state.
| IllegalStateException | If there is no active service connection. |
|---|
Removes the Cast.MessageReceivedCallback from this session for a given namespace.
| namespace | The namespace of the Cast channel. Namespaces must begin with the prefix
"urn:x-cast:". |
|---|
| IOException | If an I/O error occurs while performing the request. |
|---|---|
| IllegalArgumentException | If namespace is null or empty.
|
Requests the receiver's current status.
| IOException | If an I/O error occurs while performing the request. |
|---|---|
| IllegalStateException | If there is no active service connection. |
Sends a message to the currently connected application.
| namespace | The namespace for the message. Namespaces must begin with the prefix "
urn:x-cast:". |
|---|---|
| message | The message payload. |
PendingResult which can be used to see whether the message has been
enqueued to be sent to a Google Cast device, or null if the session is not
connected.
Sets the new Cast.MessageReceivedCallback listener on this session for a given
namespace. The new listener will replace an existing listener for a given namespace.
Messages received by the session for the given namespace will be forwarded to this
listener.
| namespace | The namespace of the Cast channel. Namespaces must begin with the prefix
"urn:x-cast:". |
|---|---|
| callbacks | The Cast.MessageReceivedCallback to perform callbacks on. May not be
null. |
| IOException | If an I/O error occurs while performing the request. |
|---|---|
| IllegalStateException | If there is no active service connection. |
| IllegalArgumentException | If namespace is null or empty, or if the
namespace doesn't start with the prefix "urn:x-cast:".
|
Mutes or unmutes the device's audio.
| IOException | If an I/O error occurs while performing the request. |
|---|---|
| IllegalStateException | If there is no active service connection. |
Sets the device volume. If volume is outside of the range [0.0, 1.0], then the
value will be clipped.
| IOException | If an I/O error occurs while performing the request. |
|---|
Ends the CastSession. This method is called only by the SDK.
| stopCasting | Should the receiver app be stopped when the current session ends. |
|---|
Resumes the CastSession. This method is called only by the SDK.
| routeInfoExtra | The extra field in the MediaRouter.RouteInfo. |
|---|
Starts the CastSession. This method is called only by the SDK.
| routeInfoExtra | The extra field in the MediaRouter.RouteInfo. |
|---|