class LibraryResult<V> : Bundleable


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

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
annotation LibraryResult.Code

Result codes.

Constants

const Bundleable.Creator<LibraryResult<MediaItem!>!>!

This property is deprecated.

Use fromItemBundle instead.

const Bundleable.Creator<LibraryResult<ImmutableList<MediaItem!>!>!>!

This property is deprecated.

Use fromItemListBundle instead.

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.

const Bundleable.Creator<LibraryResult<Any!>!>!

This property is deprecated.

Use fromUnknownBundle instead.

const Bundleable.Creator<LibraryResult<Void!>!>!

This property is deprecated.

Use fromVoidBundle instead.

Public functions

java-static LibraryResult<MediaItem!>!

Restores a LibraryResult<MediaItem> from a Bundle.

java-static LibraryResult<ImmutableList<MediaItem!>!>!

Restores a LibraryResult<ImmutableList<MediaItem> from a Bundle.

java-static LibraryResult<Any!>!

Restores a LibraryResult with unknown value type from a Bundle.

java-static LibraryResult<Void!>!

Restores a LibraryResult<Void> from a Bundle.

java-static LibraryResult<V!>!
<V> ofError(@LibraryResult.Code errorCode: Int)

Creates an instance with an unsuccessful result code.

java-static LibraryResult<V!>!
<V> ofError(
    @LibraryResult.Code errorCode: Int,
    params: MediaLibraryService.LibraryParams?
)

Creates an instance with an unsuccessful result code and LibraryParams to describe the error.

java-static LibraryResult<MediaItem!>!

Creates an instance with a media item and resultCode==RESULT_SUCCESS.

java-static LibraryResult<ImmutableList<MediaItem!>!>!
ofItemList(
    items: (Mutable)List<MediaItem!>!,
    params: MediaLibraryService.LibraryParams?
)

Creates an instance with a list of media items and resultCode==RESULT_SUCCESS.

java-static LibraryResult<Void!>!

Creates an instance with resultCode==RESULT_SUCCESS.

java-static LibraryResult<Void!>!

Creates an instance with resultCode==RESULT_SUCCESS and optional params.

Bundle!

Returns a Bundle representing the information stored in this object.

Public properties

Long

The completion time of the command in milliseconds.

MediaLibraryService.LibraryParams?

The optional parameters.

Int

The Code of this result.

V?

The value of this result.

Constants

ITEM_CREATOR

@UnstableApi
const val ITEM_CREATORBundleable.Creator<LibraryResult<MediaItem!>!>!

Object that can restore a LibraryResult<MediaItem> from a Bundle.

ITEM_LIST_CREATOR

@UnstableApi
const val ITEM_LIST_CREATORBundleable.Creator<LibraryResult<ImmutableList<MediaItem!>!>!>!

Object that can restore a LibraryResult<ImmutableList<MediaItem> from a Bundle.

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 MediaSessionCompat or .

UNKNOWN_TYPE_CREATOR

@UnstableApi
const val UNKNOWN_TYPE_CREATORBundleable.Creator<LibraryResult<Any!>!>!

Object that can restore a LibraryResult with unknown value type from a Bundle.

VOID_CREATOR

@UnstableApi
const val VOID_CREATORBundleable.Creator<LibraryResult<Void!>!>!

Object that can restore a LibraryResult<Void> from a Bundle.

Public functions

fromItemBundle

@UnstableApi
java-static fun fromItemBundle(bundle: Bundle!): LibraryResult<MediaItem!>!

Restores a LibraryResult<MediaItem> from a Bundle.

fromItemListBundle

@UnstableApi
java-static fun fromItemListBundle(bundle: Bundle!): LibraryResult<ImmutableList<MediaItem!>!>!

Restores a LibraryResult<ImmutableList<MediaItem> from a Bundle.

fromUnknownBundle

@UnstableApi
java-static fun fromUnknownBundle(bundle: Bundle!): LibraryResult<Any!>!

Restores a LibraryResult with unknown value type from a Bundle.

fromVoidBundle

@UnstableApi
java-static fun fromVoidBundle(bundle: Bundle!): LibraryResult<Void!>!

Restores a LibraryResult<Void> from a Bundle.

ofError

java-static fun <V> ofError(@LibraryResult.Code errorCode: Int): LibraryResult<V!>!

Creates an instance with an unsuccessful result code.

errorCode must not be RESULT_SUCCESS.

Parameters
@LibraryResult.Code errorCode: Int

The error code.

ofError

java-static fun <V> ofError(
    @LibraryResult.Code errorCode: Int,
    params: MediaLibraryService.LibraryParams?
): LibraryResult<V!>!

Creates an instance with an unsuccessful result code and LibraryParams to describe the error.

errorCode must not be RESULT_SUCCESS.

Parameters
@LibraryResult.Code errorCode: Int

The error code.

params: MediaLibraryService.LibraryParams?

The optional parameters to describe the error.

ofItem

java-static fun ofItem(item: MediaItem!, params: MediaLibraryService.LibraryParams?): LibraryResult<MediaItem!>!

Creates an instance with a media item and resultCode==RESULT_SUCCESS.

The mediaMetadata must specify isBrowsable and isPlayable fields.

Parameters
item: MediaItem!

The media item.

params: MediaLibraryService.LibraryParams?

The optional parameters to describe the media item.

ofItemList

java-static fun ofItemList(
    items: (Mutable)List<MediaItem!>!,
    params: MediaLibraryService.LibraryParams?
): LibraryResult<ImmutableList<MediaItem!>!>!

Creates an instance with a list of media items and resultCode==RESULT_SUCCESS.

The mediaMetadata of each item in the list must specify isBrowsable and isPlayable fields.

Parameters
items: (Mutable)List<MediaItem!>!

The list of media items.

params: MediaLibraryService.LibraryParams?

The optional parameters to describe the list of media items.

ofVoid

java-static fun ofVoid(): LibraryResult<Void!>!

Creates an instance with resultCode==RESULT_SUCCESS.

ofVoid

java-static fun ofVoid(params: MediaLibraryService.LibraryParams?): LibraryResult<Void!>!

Creates an instance with resultCode==RESULT_SUCCESS and optional params.

toBundle

@UnstableApi
fun toBundle(): Bundle!

Returns a Bundle representing the information stored in this object.

Public properties

completionTimeMs

val completionTimeMsLong

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

params

val paramsMediaLibraryService.LibraryParams?

The optional parameters.

resultCode

@LibraryResult.Code
val resultCodeInt

The Code of this result.

value

val value: V?

The value of this result. Will be null if resultCode is not RESULT_SUCCESS.