SessionCommand

Added in 1.0.0
Deprecated in 1.3.0

class SessionCommand : VersionedParcelable


Defines a command that a MediaController can send to a MediaSession.

If getCommandCode isn't COMMAND_CODE_CUSTOM), it's predefined command. If getCommandCode is COMMAND_CODE_CUSTOM), it's custom command and getCustomAction shouldn't be null.

Summary

Constants

const Int

Command code for the custom command which can be defined by string action in the SessionCommand.

const Int

Command code for getChildren.

const Int

Command code for getItem.

const Int

Command code for getLibraryRoot.

const Int

Command code for getSearchResult.

const Int

Command code for search.

const Int

Command code for subscribe.

const Int

Command code for unsubscribe.

const Int

Command code for addPlaylistItem.

const Int

Command code for deselectTrack.

const Int

Command code for getCurrentMediaItem.

const Int

Command code for getPlaylist.

const Int

Command code for getPlaylistMetadata.

const Int

Command code for replacePlaylistItem.

const Int

Command code for pause.

const Int

Command code for play.

const Int

Command code for prepare.

const Int

Command code for removePlaylistItem.

const Int

Command code for replacePlaylistItem.

const Int

Command code for seekTo.

const Int

Command code for selectTrack.

const Int

Command code for setMediaItem.

const Int

Command code for setPlaylist.

const Int

Command code for setRepeatMode.

const Int

Command code for setShuffleMode.

const Int

Command code for setPlaybackSpeed}.

const Int

Command code for setSurface.

const Int

Command code for skipToNextPlaylistItem.

const Int

Command code for skipToPlaylistItem.

const Int

Command code for skipToPreviousPlaylistItem.

const Int

Command code for updatePlaylistMetadata.

const Int

Command code for fastForward.

const Int

Command code for rewind.

const Int

Command code for setMediaUri.

const Int

Command code for setRating.

const Int

Command code for skipBackward.

const Int

Command code for skipForward.

const Int

Command code for adjustVolume.

const Int

Command code for setVolumeTo.

const Int

The first version of session commands.

const Int

The 2nd version of session commands.

Public constructors

SessionCommand(commandCode: Int)

Constructor for creating a predefined command.

SessionCommand(action: String, extras: Bundle?)

Constructor for creating a custom command.

Public functions

Boolean
equals(obj: Any!)
Int

Gets the command code of a predefined command.

String?

Gets the action of a custom command.

Bundle?

Gets the extra bundle of a custom command.

Int

Constants

COMMAND_CODE_CUSTOM

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_CUSTOM = 0: Int

Command code for the custom command which can be defined by string action in the SessionCommand.

COMMAND_CODE_LIBRARY_GET_CHILDREN

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_LIBRARY_GET_CHILDREN = 50003: Int

Command code for getChildren.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_LIBRARY_GET_ITEM

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_LIBRARY_GET_ITEM = 50004: Int

Command code for getItem.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_LIBRARY_GET_LIBRARY_ROOT

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_LIBRARY_GET_LIBRARY_ROOT = 50000: Int

Command code for getLibraryRoot.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_LIBRARY_GET_SEARCH_RESULT

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_LIBRARY_GET_SEARCH_RESULT = 50006: Int

Command code for getSearchResult.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_LIBRARY_SEARCH

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_LIBRARY_SEARCH = 50005: Int

Command code for search.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_LIBRARY_SUBSCRIBE

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_LIBRARY_SUBSCRIBE = 50001: Int

Command code for subscribe.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_LIBRARY_UNSUBSCRIBE

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_LIBRARY_UNSUBSCRIBE = 50002: Int

Command code for unsubscribe.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_ADD_PLAYLIST_ITEM

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_ADD_PLAYLIST_ITEM = 10013: Int

Command code for addPlaylistItem.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_DESELECT_TRACK

Added in 1.1.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_DESELECT_TRACK = 11002: Int

Command code for deselectTrack.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_GET_CURRENT_MEDIA_ITEM

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_GET_CURRENT_MEDIA_ITEM = 10016: Int

Command code for getCurrentMediaItem. This will expose metadata information to the controller.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_GET_PLAYLIST

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_GET_PLAYLIST = 10005: Int

Command code for getPlaylist. This will expose metadata information to the controller.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_GET_PLAYLIST_METADATA

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_GET_PLAYLIST_METADATA = 10012: Int

Command code for getPlaylistMetadata. This will expose metadata information to the controller.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_MOVE_PLAYLIST_ITEM

Added in 1.1.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_MOVE_PLAYLIST_ITEM = 10019: Int

Command code for replacePlaylistItem.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_2.

COMMAND_CODE_PLAYER_PAUSE

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_PAUSE = 10001: Int

Command code for pause.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_PLAY

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_PLAY = 10000: Int

Command code for play.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_PREPARE

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_PREPARE = 10002: Int

Command code for prepare.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_REMOVE_PLAYLIST_ITEM

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_REMOVE_PLAYLIST_ITEM = 10014: Int

Command code for removePlaylistItem.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_REPLACE_PLAYLIST_ITEM

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_REPLACE_PLAYLIST_ITEM = 10015: Int

Command code for replacePlaylistItem.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SEEK_TO

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SEEK_TO = 10003: Int

Command code for seekTo.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SELECT_TRACK

Added in 1.1.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SELECT_TRACK = 11001: Int

Command code for selectTrack.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SET_MEDIA_ITEM

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SET_MEDIA_ITEM = 10018: Int

Command code for setMediaItem.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SET_PLAYLIST

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SET_PLAYLIST = 10006: Int

Command code for setPlaylist.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SET_REPEAT_MODE

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SET_REPEAT_MODE = 10011: Int

Command code for setRepeatMode.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SET_SHUFFLE_MODE

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SET_SHUFFLE_MODE = 10010: Int

Command code for setShuffleMode.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SET_SPEED

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SET_SPEED = 10004: Int

Command code for setPlaybackSpeed}.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SET_SURFACE

Added in 1.1.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SET_SURFACE = 11000: Int

Command code for setSurface.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SKIP_TO_NEXT_PLAYLIST_ITEM

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SKIP_TO_NEXT_PLAYLIST_ITEM = 10009: Int

Command code for skipToNextPlaylistItem.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SKIP_TO_PLAYLIST_ITEM

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SKIP_TO_PLAYLIST_ITEM = 10007: Int

Command code for skipToPlaylistItem.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_SKIP_TO_PREVIOUS_PLAYLIST_ITEM

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_SKIP_TO_PREVIOUS_PLAYLIST_ITEM = 10008: Int

Command code for skipToPreviousPlaylistItem.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_PLAYER_UPDATE_LIST_METADATA

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_PLAYER_UPDATE_LIST_METADATA = 10017: Int

Command code for updatePlaylistMetadata.

Command would be sent directly to the player if the session doesn't reject the request through the onCommandRequest.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_SESSION_FAST_FORWARD

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_SESSION_FAST_FORWARD = 40000: Int

Command code for fastForward.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_SESSION_REWIND

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_SESSION_REWIND = 40001: Int

Command code for rewind.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_SESSION_SET_MEDIA_URI

Added in 1.1.0
Deprecated in 1.3.0
const val COMMAND_CODE_SESSION_SET_MEDIA_URI = 40011: Int

Command code for setMediaUri.

Code version is COMMAND_VERSION_2.

COMMAND_CODE_SESSION_SET_RATING

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_SESSION_SET_RATING = 40010: Int

Command code for setRating.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_SESSION_SKIP_BACKWARD

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_SESSION_SKIP_BACKWARD = 40003: Int

Command code for skipBackward.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_SESSION_SKIP_FORWARD

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_SESSION_SKIP_FORWARD = 40002: Int

Command code for skipForward.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_VOLUME_ADJUST_VOLUME

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_VOLUME_ADJUST_VOLUME = 30001: Int

Command code for adjustVolume.

If the session doesn't reject the request through the onCommandRequest, command would adjust the device volume. It would send to the player directly only if it's a RemoteSessionPlayer.

Code version is COMMAND_VERSION_1.

COMMAND_CODE_VOLUME_SET_VOLUME

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_CODE_VOLUME_SET_VOLUME = 30000: Int

Command code for setVolumeTo.

If the session doesn't reject the request through the onCommandRequest, command would adjust the device volume. It would send to the player directly only if it's a RemoteSessionPlayer.

Code version is COMMAND_VERSION_1.

COMMAND_VERSION_1

Added in 1.0.0
Deprecated in 1.3.0
const val COMMAND_VERSION_1 = 1: Int

The first version of session commands. This version is for commands introduced in AndroidX media2-session 1.0.0.

This would be used to specify which commands should be added by addAllPredefinedCommands

COMMAND_VERSION_2

Added in 1.1.0
Deprecated in 1.3.0
const val COMMAND_VERSION_2 = 2: Int

The 2nd version of session commands. This version is for commands introduced in AndroidX media2-session 1.1.0.

This would be used to specify which commands should be added by addAllPredefinedCommands

Public constructors

SessionCommand

Added in 1.0.0
Deprecated in 1.3.0
SessionCommand(commandCode: Int)

Constructor for creating a predefined command.

Parameters
commandCode: Int

A command code for predefined command.

SessionCommand

Added in 1.0.0
Deprecated in 1.3.0
SessionCommand(action: String, extras: Bundle?)

Constructor for creating a custom command.

Parameters
action: String

The action of this custom command.

extras: Bundle?

An extra bundle for this custom command.

Public functions

equals

fun equals(obj: Any!): Boolean

getCommandCode

Added in 1.0.0
Deprecated in 1.3.0
fun getCommandCode(): Int

Gets the command code of a predefined command. This will return COMMAND_CODE_CUSTOM for a custom command.

getCustomAction

Added in 1.0.0
Deprecated in 1.3.0
fun getCustomAction(): String?

Gets the action of a custom command. This will return null for a predefined command.

getCustomExtras

Added in 1.0.0
Deprecated in 1.3.0
fun getCustomExtras(): Bundle?

Gets the extra bundle of a custom command. This will return null for a predefined command.

hashCode

fun hashCode(): Int