Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

MediaController.ControllerResult

public static class MediaController.ControllerResult
extends Object implements VersionedParcelable

java.lang.Object
   ↳ androidx.media2.MediaController.ControllerResult


Result class to be used with ListenableFuture for asynchronous calls.

Summary

Constants

int RESULT_CODE_AUTHENTICATION_EXPIRED

Result code representing that the authentication has expired.

int RESULT_CODE_BAD_VALUE

Result code representing that an argument is illegal.

int RESULT_CODE_CONCURRENT_STREAM_LIMIT

Result code representing that too many concurrent streams are detected.

int RESULT_CODE_DISCONNECTED

Result code representing that the session and controller were disconnected.

int RESULT_CODE_INVALID_STATE

Result code representing that the command cannot be completed because the current state is not valid for the command.

int RESULT_CODE_IO_ERROR

Result code representing a file or network related command error.

int RESULT_CODE_NOT_AVAILABLE_IN_REGION

Result code representing that the content is blocked due to being regionally unavailable.

int RESULT_CODE_NOT_SUPPORTED

Result code representing that the command is not supported nor implemented.

int RESULT_CODE_PARENTAL_CONTROL_RESTRICTED

Result code representing that the content is blocked due to parental controls.

int RESULT_CODE_PERMISSION_DENIED

Result code representing that the command is not allowed.

int RESULT_CODE_PREMIUM_ACCOUNT_REQUIRED

Result code representing that a premium account is required.

int RESULT_CODE_SETUP_REQUIRED

Result code representing that the session needs user's manual intervention.

int RESULT_CODE_SKIPPED

Result code representing that the command is skipped or canceled.

int RESULT_CODE_SKIP_LIMIT_REACHED

Result code representing that the application cannot skip any more because the skip limit is reached.

int RESULT_CODE_SUCCESS

Result code representing that the command is successfully completed.

int RESULT_CODE_UNKNOWN_ERROR

Result code represents that call is ended with an unknown error.

Public constructors

MediaController.ControllerResult(int resultCode, Bundle customCommandResult)

Constructor to be used by MediaController.ControllerCallback.onCustomCommand(MediaController, SessionCommand, Bundle).

Public methods

long getCompletionTime()

Gets the completion time of the command.

Bundle getCustomCommandResult()

Gets the result of MediaController.sendCustomCommand(SessionCommand, Bundle).

MediaItem getMediaItem()

Gets the MediaItem for which the command was executed.

int getResultCode()

Gets the result code.

Inherited methods

Constants

RESULT_CODE_AUTHENTICATION_EXPIRED

public static final int RESULT_CODE_AUTHENTICATION_EXPIRED

Result code representing that the authentication has expired.

Constant Value: -102 (0xffffff9a)

RESULT_CODE_BAD_VALUE

public static final int RESULT_CODE_BAD_VALUE

Result code representing that an argument is illegal.

Constant Value: -3 (0xfffffffd)

RESULT_CODE_CONCURRENT_STREAM_LIMIT

public static final int RESULT_CODE_CONCURRENT_STREAM_LIMIT

Result code representing that too many concurrent streams are detected.

Constant Value: -104 (0xffffff98)

RESULT_CODE_DISCONNECTED

public static final int RESULT_CODE_DISCONNECTED

Result code representing that the session and controller were disconnected.

Constant Value: -100 (0xffffff9c)

RESULT_CODE_INVALID_STATE

public static final int RESULT_CODE_INVALID_STATE

Result code representing that the command cannot be completed because the current state is not valid for the command.

Constant Value: -2 (0xfffffffe)

RESULT_CODE_IO_ERROR

public static final int RESULT_CODE_IO_ERROR

Result code representing a file or network related command error.

Constant Value: -5 (0xfffffffb)

RESULT_CODE_NOT_AVAILABLE_IN_REGION

public static final int RESULT_CODE_NOT_AVAILABLE_IN_REGION

Result code representing that the content is blocked due to being regionally unavailable.

Constant Value: -106 (0xffffff96)

RESULT_CODE_NOT_SUPPORTED

public static final int RESULT_CODE_NOT_SUPPORTED

Result code representing that the command is not supported nor implemented.

Constant Value: -6 (0xfffffffa)

RESULT_CODE_PARENTAL_CONTROL_RESTRICTED

public static final int RESULT_CODE_PARENTAL_CONTROL_RESTRICTED

Result code representing that the content is blocked due to parental controls.

Constant Value: -105 (0xffffff97)

RESULT_CODE_PERMISSION_DENIED

public static final int RESULT_CODE_PERMISSION_DENIED

Result code representing that the command is not allowed.

Constant Value: -4 (0xfffffffc)

RESULT_CODE_PREMIUM_ACCOUNT_REQUIRED

public static final int RESULT_CODE_PREMIUM_ACCOUNT_REQUIRED

Result code representing that a premium account is required.

Constant Value: -103 (0xffffff99)

RESULT_CODE_SETUP_REQUIRED

public static final int RESULT_CODE_SETUP_REQUIRED

Result code representing that the session needs user's manual intervention.

Constant Value: -108 (0xffffff94)

RESULT_CODE_SKIPPED

public static final int RESULT_CODE_SKIPPED

Result code representing that the command is skipped or canceled. For an example, a seek command can be skipped if it is followed by another seek command.

Constant Value: 1 (0x00000001)

RESULT_CODE_SKIP_LIMIT_REACHED

public static final int RESULT_CODE_SKIP_LIMIT_REACHED

Result code representing that the application cannot skip any more because the skip limit is reached.

Constant Value: -107 (0xffffff95)

RESULT_CODE_SUCCESS

public static final int RESULT_CODE_SUCCESS

Result code representing that the command is successfully completed.

Interoperability: When connected to MediaSessionCompat, this can be also used to tell that the command was successfully sent, but the result is unknown.

Constant Value: 0 (0x00000000)

RESULT_CODE_UNKNOWN_ERROR

public static final int RESULT_CODE_UNKNOWN_ERROR

Result code represents that call is ended with an unknown error.

Constant Value: -1 (0xffffffff)

Public constructors

MediaController.ControllerResult

public MediaController.ControllerResult (int resultCode, 
                Bundle customCommandResult)

Constructor to be used by MediaController.ControllerCallback.onCustomCommand(MediaController, SessionCommand, Bundle).

Parameters
resultCode int: result code

customCommandResult Bundle: custom command result

Public methods

getCompletionTime

public long getCompletionTime ()

Gets the completion time of the command. Being more specific, it's the same as SystemClock.elapsedRealtime() when the command is completed.

Returns
long completion time of the command

getCustomCommandResult

public Bundle getCustomCommandResult ()

Gets the result of MediaController.sendCustomCommand(SessionCommand, Bundle). This is only valid when it's returned by the MediaController.sendCustomCommand(SessionCommand, Bundle) and will be null otherwise.

Returns
Bundle result of send custom command

getMediaItem

public MediaItem getMediaItem ()

Gets the MediaItem for which the command was executed. In other words, this is the current media item when the command was completed.

Can be null for many reasons. For examples,

  • Error happened.
  • Current media item was null at that time.
  • Command is irrelevant with the media item (e.g. custom command).

Returns
MediaItem media item when the command is completed. Can be null for an error, the current media item was null, or any other reason.