SessionResult

Added in 1.0.0
Deprecated in 1.3.0

class SessionResult : VersionedParcelable


Result class to be used with ListenableFuture for asynchronous calls between and MediaController.

Summary

Constants

const Int

Result code representing that the authentication has expired.

const Int

Result code representing that too many concurrent streams are detected.

const Int

Result code representing that the session and controller were disconnected.

const Int

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

const Int

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

const Int

Result code representing that a premium account is required.

const Int

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

const Int

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

const Int

Result code representing that the command is successfully completed.

Public constructors

SessionResult(resultCode: Int, customCommandResult: Bundle?)

Constructor to be used by onCustomCommand.

Public functions

Long

Gets the completion time of the command.

Bundle?

Gets the result of sendCustomCommand and sendCustomCommand only when this object is returned by one of them.

MediaItem?

Gets the MediaItem for which the command was executed.

Int

Gets the result code.

Constants

RESULT_ERROR_SESSION_AUTHENTICATION_EXPIRED

Added in 1.0.0
const val RESULT_ERROR_SESSION_AUTHENTICATION_EXPIRED = -102: Int

Result code representing that the authentication has expired.

RESULT_ERROR_SESSION_CONCURRENT_STREAM_LIMIT

Added in 1.0.0
const val RESULT_ERROR_SESSION_CONCURRENT_STREAM_LIMIT = -104: Int

Result code representing that too many concurrent streams are detected.

RESULT_ERROR_SESSION_DISCONNECTED

Added in 1.0.0
const val RESULT_ERROR_SESSION_DISCONNECTED = -100: Int

Result code representing that the session and controller were disconnected.

RESULT_ERROR_SESSION_NOT_AVAILABLE_IN_REGION

Added in 1.0.0
const val RESULT_ERROR_SESSION_NOT_AVAILABLE_IN_REGION = -106: Int

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

RESULT_ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED

Added in 1.0.0
const val RESULT_ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED = -105: Int

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

RESULT_ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED

Added in 1.0.0
const val RESULT_ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED = -103: Int

Result code representing that a premium account is required.

RESULT_ERROR_SESSION_SETUP_REQUIRED

Added in 1.0.0
const val RESULT_ERROR_SESSION_SETUP_REQUIRED = -108: Int

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

RESULT_ERROR_SESSION_SKIP_LIMIT_REACHED

Added in 1.0.0
const val RESULT_ERROR_SESSION_SKIP_LIMIT_REACHED = -107: Int

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

RESULT_SUCCESS

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

Result code representing that the command is successfully completed.

Interoperability: This code is also used to tell that the command was successfully sent, but the result is unknown when connected with MediaSessionCompat or MediaControllerCompat.

Public constructors

SessionResult

Added in 1.0.0
Deprecated in 1.3.0
SessionResult(resultCode: Int, customCommandResult: Bundle?)

Constructor to be used by onCustomCommand.

Parameters
resultCode: Int

result code

customCommandResult: Bundle?

custom command result.

Public functions

getCompletionTime

Added in 1.0.0
Deprecated in 1.3.0
fun getCompletionTime(): Long

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

Returns
Long

completion time of the command

getCustomCommandResult

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

Gets the result of sendCustomCommand and sendCustomCommand only when this object is returned by one of them.

If this object is returned by other methods, this method will be null.

Returns
Bundle?

result of sending custom command

getMediaItem

Added in 1.0.0
Deprecated in 1.3.0
fun getMediaItem(): MediaItem?

Gets the MediaItem for which the command was executed. In other words, this is the current media item when the command 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 completed. Can be null for an error, the current media item was null, or any other reason.