belongs to Maven artifact com.android.support:mediarouter-v7:28.0.0-alpha1
MediaSessionStatus
public
final
class
MediaSessionStatus
extends Object
java.lang.Object | |
↳ | android.support.v7.media.MediaSessionStatus |
Describes the playback status of a media session.
This class is part of the remote playback protocol described by the
MediaControlIntent
class.
When a media session is created, it is initially in the
active
state. When the media session ends
normally, it transitions to the ended
state.
If the media session is invalidated due to another session forcibly taking
control of the route, then it transitions to the
invalidated
state.
Refer to the documentation of each state for an explanation of its meaning.
To monitor session status, the application should supply a PendingIntent
to use as the
session status update receiver
for a given session start request
.
This object is immutable once created using a MediaSessionStatus.Builder
instance.
Summary
Nested classes | |
---|---|
class |
MediaSessionStatus.Builder
Builder for |
Constants | |
---|---|
int |
SESSION_STATE_ACTIVE
Session state: Active. |
int |
SESSION_STATE_ENDED
Session state: Ended. |
int |
SESSION_STATE_INVALIDATED
Session state: Invalidated. |
Public methods | |
---|---|
Bundle
|
asBundle()
Converts this object to a bundle for serialization. |
static
MediaSessionStatus
|
fromBundle(Bundle bundle)
Creates an instance from a bundle. |
Bundle
|
getExtras()
Gets a bundle of extras for this status object. |
int
|
getSessionState()
Gets the session state. |
long
|
getTimestamp()
Gets the timestamp associated with the status information in
milliseconds since boot in the |
boolean
|
isQueuePaused()
Returns true if the session's queue is paused. |
String
|
toString()
|
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Constants
SESSION_STATE_ACTIVE
int SESSION_STATE_ACTIVE
Session state: Active.
Indicates that the media session is active and in control of the route.
Constant Value: 0 (0x00000000)
SESSION_STATE_ENDED
int SESSION_STATE_ENDED
Session state: Ended.
Indicates that the media session was ended normally using the
end session
action.
A terminated media session cannot be used anymore. To play more media, the application must start a new session.
Constant Value: 1 (0x00000001)
SESSION_STATE_INVALIDATED
int SESSION_STATE_INVALIDATED
Session state: Invalidated.
Indicates that the media session was invalidated involuntarily due to another session taking control of the route.
An invalidated media session cannot be used anymore. To play more media, the application must start a new session.
Constant Value: 2 (0x00000002)
Public methods
asBundle
Bundle asBundle ()
Converts this object to a bundle for serialization.
Returns | |
---|---|
Bundle |
The contents of the object represented as a bundle. |
fromBundle
MediaSessionStatus fromBundle (Bundle bundle)
Creates an instance from a bundle.
Parameters | |
---|---|
bundle |
Bundle : The bundle, or null if none. |
Returns | |
---|---|
MediaSessionStatus |
The new instance, or null if the bundle was null. |
getExtras
Bundle getExtras ()
Gets a bundle of extras for this status object. The extras will be ignored by the media router but they may be used by applications.
Returns | |
---|---|
Bundle |
getSessionState
int getSessionState ()
Gets the session state.
Returns | |
---|---|
int |
The session state. One of SESSION_STATE_ACTIVE ,
SESSION_STATE_ENDED , or SESSION_STATE_INVALIDATED .
|
getTimestamp
long getTimestamp ()
Gets the timestamp associated with the status information in
milliseconds since boot in the elapsedRealtime()
time base.
Returns | |
---|---|
long |
The status timestamp in the elapsedRealtime() time base.
|
isQueuePaused
boolean isQueuePaused ()
Returns true if the session's queue is paused.
Returns | |
---|---|
boolean |
True if the session's queue is paused. |
toString
String toString ()
Returns | |
---|---|
String |
Interfaces
Classes
- MediaControlIntent
- MediaItemMetadata
- MediaItemStatus
- MediaItemStatus.Builder
- MediaRouteDescriptor
- MediaRouteDescriptor.Builder
- MediaRouteDiscoveryRequest
- MediaRouteProvider
- MediaRouteProvider.Callback
- MediaRouteProvider.ProviderMetadata
- MediaRouteProvider.RouteController
- MediaRouteProviderDescriptor
- MediaRouteProviderDescriptor.Builder
- MediaRouteProviderService
- MediaRouter
- MediaRouter.Callback
- MediaRouter.ControlRequestCallback
- MediaRouter.ProviderInfo
- MediaRouter.RouteInfo
- MediaRouteSelector
- MediaRouteSelector.Builder
- MediaSessionStatus
- MediaSessionStatus.Builder
- RemotePlaybackClient
- RemotePlaybackClient.ActionCallback
- RemotePlaybackClient.ItemActionCallback
- RemotePlaybackClient.SessionActionCallback
- RemotePlaybackClient.StatusCallback
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.