class SessionResult


A result to be used with ListenableFuture for asynchronous calls between and MediaController.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = [SessionError.INFO_CANCELLED, SessionError.ERROR_UNKNOWN, SessionError.ERROR_INVALID_STATE, SessionError.ERROR_BAD_VALUE, SessionError.ERROR_PERMISSION_DENIED, SessionError.ERROR_IO, SessionError.ERROR_SESSION_DISCONNECTED, SessionError.ERROR_NOT_SUPPORTED, SessionError.ERROR_SESSION_AUTHENTICATION_EXPIRED, SessionError.ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED, SessionError.ERROR_SESSION_CONCURRENT_STREAM_LIMIT, SessionError.ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED, SessionError.ERROR_SESSION_NOT_AVAILABLE_IN_REGION, SessionError.ERROR_SESSION_SKIP_LIMIT_REACHED, SessionError.ERROR_SESSION_SETUP_REQUIRED])
annotation SessionResult.Code

Result codes.

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 that a file or network related error happened.

const Int

Result code representing that the command is not supported.

const Int

Result code representing that the command is not allowed.

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 ended with an unknown error.

const Int

Result code representing that the command is skipped.

const Int

Result code representing that the command is successfully completed.

Public constructors

Creates an instance with a result code.

Creates an instance from a SessionError.

SessionResult(@SessionResult.Code resultCode: Int, extras: Bundle!)

Creates an instance with a result code and an extra Bundle.

@UnstableApi
SessionResult(sessionError: SessionError!, extras: Bundle!)

Creates an instance from a SessionError and an extras Bundle.

Public functions

java-static SessionResult!

Restores a SessionResult from a Bundle.

Bundle!

Public properties

Long

The completion time of the command.

Bundle!

The extra Bundle for the result.

Int

The Code of this result.

SessionError?

The optional session error.

Constants

RESULT_ERROR_BAD_VALUE

const val RESULT_ERROR_BAD_VALUE = -3: Int

Result code representing that an argument is illegal.

RESULT_ERROR_INVALID_STATE

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

const val RESULT_ERROR_IO = -5: Int

Result code representing that a file or network related error happened.

RESULT_ERROR_NOT_SUPPORTED

const val RESULT_ERROR_NOT_SUPPORTED = -6: Int

Result code representing that the command is not supported.

RESULT_ERROR_PERMISSION_DENIED

const val RESULT_ERROR_PERMISSION_DENIED = -4: Int

Result code representing that the command is not allowed.

RESULT_ERROR_SESSION_AUTHENTICATION_EXPIRED

const val RESULT_ERROR_SESSION_AUTHENTICATION_EXPIRED = -102: Int

Result code representing that the authentication has expired.

RESULT_ERROR_SESSION_CONCURRENT_STREAM_LIMIT

const val RESULT_ERROR_SESSION_CONCURRENT_STREAM_LIMIT = -104: Int

Result code representing that too many concurrent streams are detected.

RESULT_ERROR_SESSION_DISCONNECTED

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

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

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

const val RESULT_ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED = -103: Int

Result code representing that a premium account is required.

RESULT_ERROR_SESSION_SETUP_REQUIRED

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

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_ERROR_UNKNOWN

const val RESULT_ERROR_UNKNOWN = -1: Int

Result code representing that the command is ended with an unknown error.

RESULT_INFO_SKIPPED

const val RESULT_INFO_SKIPPED = 1: Int

Result code representing that the command is skipped.

RESULT_SUCCESS

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 android.support.v4.media.session.MediaSessionCompat or android.support.v4.media.session.MediaControllerCompat.

Public constructors

SessionResult

SessionResult(@SessionResult.Code resultCode: Int)

Creates an instance with a result code.

Note: Use SessionResult for errors to provide a localized error message for your users.

Parameters
@SessionResult.Code resultCode: Int

The result code.

SessionResult

@UnstableApi
SessionResult(sessionError: SessionError!)

Creates an instance from a SessionError. The resultCode is taken from code and the session result extras Bundle is empty.

Parameters
sessionError: SessionError!

The session error.

SessionResult

SessionResult(@SessionResult.Code resultCode: Int, extras: Bundle!)

Creates an instance with a result code and an extra Bundle.

Note: Use SessionResult for errors to provide a localized error message for your users.

Parameters
@SessionResult.Code resultCode: Int

The result code.

extras: Bundle!

The extra Bundle.

SessionResult

@UnstableApi
SessionResult(sessionError: SessionError!, extras: Bundle!)

Creates an instance from a SessionError and an extras Bundle. The resultCode is taken from the SessionError.

Parameters
sessionError: SessionError!

The SessionError.

extras: Bundle!

The extra Bundle.

Public functions

fromBundle

@UnstableApi
java-static fun fromBundle(bundle: Bundle!): SessionResult!

Restores a SessionResult from a Bundle.

toBundle

@UnstableApi
fun toBundle(): Bundle!

Public properties

completionTimeMs

val completionTimeMsLong

The completion time of the command. It's the same as elapsedRealtime when the command is completed.

extras

val extrasBundle!

The extra Bundle for the result.

resultCode

@SessionResult.Code
val resultCodeInt

The Code of this result.

sessionError

@UnstableApi
val sessionErrorSessionError?

The optional session error.