public class

MediaController.ControllerResult

extends java.lang.Object

implements androidx.media2.RemoteResult, VersionedParcelable

 java.lang.Object

↳androidx.media2.MediaController.ControllerResult

Overview

Result class to be used with for asynchronous calls.

Summary

Fields
public static final intRESULT_CODE_SUCCESS

Result code representing that the command is successfully completed.

Constructors
publicControllerResult(int resultCode, Bundle customCommandResult)

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

Methods
public longgetCompletionTime()

Gets the completion time of the command.

public BundlegetCustomCommandResult()

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

public MediaItemgetMediaItem()

Gets the MediaItem for which the command was executed.

public intgetResultCode()

Gets the result code.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public static final int RESULT_CODE_SUCCESS

Result code representing that the command is successfully completed.

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

Constructors

public ControllerResult(int resultCode, Bundle customCommandResult)

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

Parameters:

resultCode: result code
customCommandResult: custom command result

Methods

public int getResultCode()

Gets the result code.

Returns:

result code

See also: MediaController.ControllerResult.RESULT_CODE_SUCCESS, RESULT_CODE_UNKNOWN_ERROR, RESULT_CODE_INVALID_STATE, RESULT_CODE_BAD_VALUE, RESULT_CODE_PERMISSION_DENIED, RESULT_CODE_IO_ERROR, RESULT_CODE_SKIPPED, RESULT_CODE_DISCONNECTED, RESULT_CODE_NOT_SUPPORTED, RESULT_CODE_AUTHENTICATION_EXPIRED, RESULT_CODE_PREMIUM_ACCOUNT_REQUIRED, RESULT_CODE_CONCURRENT_STREAM_LIMIT, RESULT_CODE_PARENTAL_CONTROL_RESTRICTED, RESULT_CODE_NOT_AVAILABLE_IN_REGION, RESULT_CODE_SKIP_LIMIT_REACHED, RESULT_CODE_SETUP_REQUIRED

public long getCompletionTime()

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

Returns:

completion time of the command

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:

result of send custom command

See also: MediaController.sendCustomCommand(SessionCommand, Bundle)

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:

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