# LibraryResult

Artifact: [androidx.media3:media3-session](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/session/LibraryResult.java+class:androidx.media3.session.LibraryResult)

*** ** * ** ***


```
class LibraryResult<V : Any?>
```

<br />

*** ** * ** ***

A result to be used with `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` for asynchronous calls between `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.MediaLibrarySession` and `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaBrowser`.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/kotlin/androidx/annotation/IntDef(value = [https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.INFO_CANCELLED, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_UNKNOWN, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_INVALID_STATE, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_BAD_VALUE, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_PERMISSION_DENIED, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_IO, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_SESSION_DISCONNECTED, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_NOT_SUPPORTED, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_SESSION_AUTHENTICATION_EXPIRED, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_SESSION_CONCURRENT_STREAM_LIMIT, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_SESSION_NOT_AVAILABLE_IN_REGION, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_SESSION_SKIP_LIMIT_REACHED, https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError.ERROR_SESSION_SETUP_REQUIRED]) annotation https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code` Result codes. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_BAD_VALUE() = -3` Result code representing that an argument is illegal. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_INVALID_STATE() = -2` Result code representing that the command cannot be completed because the current state is not valid for the command. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_IO() = -5` Result code representing that a file or network related error happened. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_NOT_SUPPORTED() = -6` Result code representing that the command is not supported. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_PERMISSION_DENIED() = -4` Result code representing that the command is not allowed. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_SESSION_AUTHENTICATION_EXPIRED() = -102` Result code representing that the authentication has expired. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_SESSION_CONCURRENT_STREAM_LIMIT() = -104` Result code representing that too many concurrent streams are detected. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_SESSION_DISCONNECTED() = -100` Result code representing that the session and controller were disconnected. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_SESSION_NOT_AVAILABLE_IN_REGION() = -106` Result code representing that the content is blocked due to being regionally unavailable. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED() = -105` Result code representing that the content is blocked due to parental controls. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED() = -103` Result code representing that a premium account is required. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_SESSION_SETUP_REQUIRED() = -108` Result code representing that the session needs user's manual intervention. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_SESSION_SKIP_LIMIT_REACHED() = -107` Result code representing that the application cannot skip any more because the skip limit is reached. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_ERROR_UNKNOWN() = -1` Result code representing that the command is ended with an unknown error. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_INFO_SKIPPED() = 1` Result code representing that the command is skipped. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS() = 0` Result code representing that the command is successfully completed. |

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi [fromItemBundle](https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromItemBundle(android.os.Bundle))(bundle: https://developer.android.com/reference/android/os/Bundle.html!)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromItemBundle(android.os.Bundle,int)` instead. <br /> |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromItemBundle(android.os.Bundle,int)(bundle: https://developer.android.com/reference/android/os/Bundle.html!, interfaceVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Restores a `LibraryResult<MediaItem>` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!>!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi [fromItemListBundle](https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromItemListBundle(android.os.Bundle))(bundle: https://developer.android.com/reference/android/os/Bundle.html!)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromItemListBundle(android.os.Bundle,int)` instead. <br /> |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!>!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromItemListBundle(android.os.Bundle,int)(bundle: https://developer.android.com/reference/android/os/Bundle.html!, interfaceVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Restores a `LibraryResult<ImmutableList<MediaItem>` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<*>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi [fromUnknownBundle](https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromUnknownBundle(android.os.Bundle))(bundle: https://developer.android.com/reference/android/os/Bundle.html!)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromUnknownBundle(android.os.Bundle,int)` instead. <br /> |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<*>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromUnknownBundle(android.os.Bundle,int)(bundle: https://developer.android.com/reference/android/os/Bundle.html!, interfaceVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Restores a `LibraryResult` with unknown value type from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<https://developer.android.com/reference/java/lang/Void.html!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi [fromVoidBundle](https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromVoidBundle(android.os.Bundle))(bundle: https://developer.android.com/reference/android/os/Bundle.html!)` **This function is deprecated.** USe `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromVoidBundle(android.os.Bundle,int)` instead. <br /> |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<https://developer.android.com/reference/java/lang/Void.html!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromVoidBundle(android.os.Bundle,int)(bundle: https://developer.android.com/reference/android/os/Bundle.html!, interfaceVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Restores a `LibraryResult<Void>` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<V!>!` | `<V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#ofError(int)(@https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code errorCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates an instance with an unsuccessful `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<V!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi <V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#ofError(androidx.media3.session.SessionError)(sessionError: https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError!)` Creates an instance with a `https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError` to describe the error. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<V!>!` | `<V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#ofError(int,androidx.media3.session.MediaLibraryService.LibraryParams)( @https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code errorCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, params: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams? )` Creates an instance with an unsuccessful `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code` and `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams` to describe the error. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<V!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi <V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#ofError(androidx.media3.session.SessionError,androidx.media3.session.MediaLibraryService.LibraryParams)( sessionError: https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError!, params: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams! )` Creates an instance with a `https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError` to describe the error, and the `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#ofItem(androidx.media3.common.MediaItem,androidx.media3.session.MediaLibraryService.LibraryParams)(item: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!, params: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams?)` Creates an instance with a media item and `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()``==``https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!>!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#ofItemList(java.util.List<androidx.media3.common.MediaItem>,androidx.media3.session.MediaLibraryService.LibraryParams)( items: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!>!, params: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams? )` Creates an instance with a list of media items and `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()``==``https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<https://developer.android.com/reference/java/lang/Void.html!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#ofVoid()()` Creates an instance with `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()``==``https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult<https://developer.android.com/reference/java/lang/Void.html!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#ofVoid(androidx.media3.session.MediaLibraryService.LibraryParams)(params: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams?)` Creates an instance with `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()``==``https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()` and optional `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams`. |
| `https://developer.android.com/reference/android/os/Bundle.html!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi [toBundle](https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#toBundle())()` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#toBundle(int)` instead. <br /> |
| `https://developer.android.com/reference/android/os/Bundle.html!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#toBundle(int)(interfaceVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#completionTimeMs()` The completion time of the command in milliseconds. |
| `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams?` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#params()` The optional parameters. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()` The `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code` of this result. |
| `https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError?` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#sessionError()` The optional session error. |
| `V?` | `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#value()` The value of this result. |

## 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 functions

### fromItemBundle

```
@UnstableApi
java-static fun [fromItemBundle](https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromItemBundle(android.os.Bundle))(bundle: Bundle!): LibraryResult<MediaItem!>!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromItemBundle(android.os.Bundle,int)` instead.

### fromItemBundle

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

Restores a `LibraryResult<MediaItem>` from a `https://developer.android.com/reference/android/os/Bundle.html`.

| Parameters |
|---|---|
| `bundle: https://developer.android.com/reference/android/os/Bundle.html!` | The `https://developer.android.com/reference/android/os/Bundle.html`. |
| `interfaceVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaLibraryInfo#INTERFACE_VERSION()` of the sending process. |

### fromItemListBundle

```
@UnstableApi
java-static fun [fromItemListBundle](https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromItemListBundle(android.os.Bundle))(bundle: Bundle!): LibraryResult<ImmutableList<MediaItem!>!>!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromItemListBundle(android.os.Bundle,int)` instead.

### fromItemListBundle

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

Restores a `LibraryResult<ImmutableList<MediaItem>` from a `https://developer.android.com/reference/android/os/Bundle.html`.

| Parameters |
|---|---|
| `bundle: https://developer.android.com/reference/android/os/Bundle.html!` | The `https://developer.android.com/reference/android/os/Bundle.html`. |
| `interfaceVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaLibraryInfo#INTERFACE_VERSION()` of the sending process. |

### fromUnknownBundle

```
@UnstableApi
java-static fun [fromUnknownBundle](https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromUnknownBundle(android.os.Bundle))(bundle: Bundle!): LibraryResult<*>!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromUnknownBundle(android.os.Bundle,int)` instead.

### fromUnknownBundle

```
@UnstableApi
java-static fun fromUnknownBundle(bundle: Bundle!, interfaceVersion: Int): LibraryResult<*>!
```

Restores a `LibraryResult` with unknown value type from a `https://developer.android.com/reference/android/os/Bundle.html`.

| Parameters |
|---|---|
| `bundle: https://developer.android.com/reference/android/os/Bundle.html!` | The `https://developer.android.com/reference/android/os/Bundle.html`. |
| `interfaceVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaLibraryInfo#INTERFACE_VERSION()` of the sending process. |

### fromVoidBundle

```
@UnstableApi
java-static fun [fromVoidBundle](https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromVoidBundle(android.os.Bundle))(bundle: Bundle!): LibraryResult<Void!>!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> USe `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#fromVoidBundle(android.os.Bundle,int)` instead.

### fromVoidBundle

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

Restores a `LibraryResult<Void>` from a `https://developer.android.com/reference/android/os/Bundle.html`.

| Parameters |
|---|---|
| `bundle: https://developer.android.com/reference/android/os/Bundle.html!` | The `https://developer.android.com/reference/android/os/Bundle.html`. |
| `interfaceVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaLibraryInfo#INTERFACE_VERSION()` of the sending process. |

### ofError

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

Creates an instance with an unsuccessful `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code`.

`errorCode` must not be `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()`.

Note: This method will be deprecated when `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#ofError(androidx.media3.session.SessionError)` is promoted to stable API status.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code errorCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The error code. Value is one of the following: - `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` <br /> |

### ofError

```
@UnstableApi
java-static fun <V : Any?> ofError(sessionError: SessionError!): LibraryResult<V!>!
```

Creates an instance with a `https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError` to describe the error. The `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()` is taken from `https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError#code()`.

| Parameters |
|---|---|
| `sessionError: https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError!` | The `https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError`. |

### ofError

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

Creates an instance with an unsuccessful `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code` and `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams` to describe the error.

`errorCode` must not be `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()`.

Note: This method will be deprecated when `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#ofError(androidx.media3.session.SessionError,androidx.media3.session.MediaLibraryService.LibraryParams)` is promoted to stable API status.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code errorCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The error code. Value is one of the following: - `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` <br /> |
| `params: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams?` | The optional parameters to describe the error. |

### ofError

```
@UnstableApi
java-static fun <V : Any?> ofError(
    sessionError: SessionError!,
    params: MediaLibraryService.LibraryParams!
): LibraryResult<V!>!
```

Creates an instance with a `https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError` to describe the error, and the `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams`. The `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()` is taken from `https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError#code()`.

| Parameters |
|---|---|
| `sessionError: https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError!` | The `https://developer.android.com/reference/kotlin/androidx/media3/session/SessionError`. |
| `params: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams!` | The `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams` sent by the browser. |

### ofItem

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

Creates an instance with a media item and `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()``==``https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()`.

The `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem#mediaMetadata()` must specify `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata#isBrowsable()` and `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata#isPlayable()` fields.

| Parameters |
|---|---|
| `item: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!` | The media item. |
| `params: https://developer.android.com/reference/kotlin/androidx/media3/session/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 `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()``==``https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()`.

The `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem#mediaMetadata()` of each item in the list must specify `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata#isBrowsable()` and `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata#isPlayable()` fields.

| Parameters |
|---|---|
| `items: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!>!` | The list of media items. |
| `params: https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams?` | The optional parameters to describe the list of media items. |

### ofVoid

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

Creates an instance with `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()``==``https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()`.

### ofVoid

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

Creates an instance with `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()``==``https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()` and optional `https://developer.android.com/reference/kotlin/androidx/media3/session/MediaLibraryService.LibraryParams`.

### toBundle

```
@UnstableApi
fun [toBundle](https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#toBundle())(): Bundle!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#toBundle(int)` instead.

### toBundle

```
@UnstableApi
fun toBundle(interfaceVersion: Int): Bundle!
```

## Public properties

### completionTimeMs

```
val completionTimeMs: Long
```

The completion time of the command in milliseconds. It's the same as `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` when the command is completed.

### params

```
val params: MediaLibraryService.LibraryParams?
```

The optional parameters.

### resultCode

```
@LibraryResult.Code
val resultCode: Int
```

The `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult.Code` of this result.

Value is one of the following:

- `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`

<br />

### sessionError

```
@UnstableApi
val sessionError: SessionError?
```

The optional session error.

### value

```
val value: V?
```

The value of this result. Will be `null` if `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#resultCode()` is not `https://developer.android.com/reference/kotlin/androidx/media3/session/LibraryResult#RESULT_SUCCESS()`.