SessionPlayer.PlayerResult

Added in 1.0.0
Deprecated in 1.3.0

class SessionPlayer.PlayerResult


Result class of the asynchronous APIs.

Subclass may extend this class for providing more result and/or custom result code. For the custom result code, follow the convention below to avoid potential code duplication.

  • Predefined error code: Negative integers greater than -100. (i.e. -100
  • Custom error code: Negative integers equal to or less than -1000. (i.e. code <-1000)
  • Predefined info code: Positive integers less than 100. (i.e. 0
  • Custom Info code: Positive integers equal to or greater than 1000. (i.e. code >+1000)

Summary

Constants

const Int

Result code representing that an argument is illegal.

const Int

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

const Int

Result code representing a file or network related command error.

const Int

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

const Int

Result code representing that the command is not allowed.

const Int

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

const Int

Result code representing that the command is skipped or canceled.

const Int

Result code representing that the command is successfully completed.

Public constructors

PlayerResult(resultCode: Int, item: MediaItem?)

Constructor that uses the current system clock as the completion time.

Public functions

Long

Gets the completion time of the command.

MediaItem?

Gets the MediaItem for which the command was executed.

Int

Gets the result code.

Constants

RESULT_ERROR_BAD_VALUE

Added in 1.0.0
const val RESULT_ERROR_BAD_VALUE = -3: Int

Result code representing that an argument is illegal.

RESULT_ERROR_INVALID_STATE

Added in 1.0.0
const val RESULT_ERROR_INVALID_STATE = -2: Int

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

RESULT_ERROR_IO

Added in 1.0.0
const val RESULT_ERROR_IO = -5: Int

Result code representing a file or network related command error.

RESULT_ERROR_NOT_SUPPORTED

Added in 1.0.0
const val RESULT_ERROR_NOT_SUPPORTED = -6: Int

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

RESULT_ERROR_PERMISSION_DENIED

Added in 1.0.0
const val RESULT_ERROR_PERMISSION_DENIED = -4: Int

Result code representing that the command is not allowed.

RESULT_ERROR_UNKNOWN

Added in 1.0.0
const val RESULT_ERROR_UNKNOWN = -1: Int

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

RESULT_INFO_SKIPPED

Added in 1.0.0
const val RESULT_INFO_SKIPPED = 1: Int

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.

RESULT_SUCCESS

Added in 1.0.0
const val RESULT_SUCCESS = 0: Int

Result code representing that the command is successfully completed.

Public constructors

PlayerResult

Added in 1.0.0
Deprecated in 1.3.0
PlayerResult(resultCode: Int, item: MediaItem?)

Constructor that uses the current system clock as the completion time.

Parameters
resultCode: Int

result code. Recommends to use the standard code defined here.

item: MediaItem?

media item when the command completed

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

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 item sent as an argument of the command if any, otherwise the current media item when the command completed.

Returns
MediaItem?

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

getResultCode

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

Gets the result code.

Subclass of the SessionPlayer may have defined customized extra code other than codes defined here. Check the documentation of the class that you're interested in.

Returns
Int

result code