LibraryResult
public
class
LibraryResult
extends Object
implements
VersionedParcelable
java.lang.Object | |
↳ | androidx.media2.session.LibraryResult |
Result class to be used with ListenableFuture
for asynchronous calls between
MediaLibraryService.MediaLibrarySession
and MediaBrowser
.
Summary
Constants | |
---|---|
int |
RESULT_ERROR_BAD_VALUE
Result code representing that an argument is illegal. |
int |
RESULT_ERROR_INVALID_STATE
Result code representing that the command cannot be completed because the current state is not valid for the command. |
int |
RESULT_ERROR_IO
Result code representing a file or network related command error. |
int |
RESULT_ERROR_NOT_SUPPORTED
Result code representing that the command is not supported nor implemented. |
int |
RESULT_ERROR_PERMISSION_DENIED
Result code representing that the command is not allowed. |
int |
RESULT_ERROR_SESSION_AUTHENTICATION_EXPIRED
Result code representing that the authentication has expired. |
int |
RESULT_ERROR_SESSION_CONCURRENT_STREAM_LIMIT
Result code representing that too many concurrent streams are detected. |
int |
RESULT_ERROR_SESSION_DISCONNECTED
Result code representing that the session and controller were disconnected. |
int |
RESULT_ERROR_SESSION_NOT_AVAILABLE_IN_REGION
Result code representing that the content is blocked due to being regionally unavailable. |
int |
RESULT_ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED
Result code representing that the content is blocked due to parental controls. |
int |
RESULT_ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED
Result code representing that a premium account is required. |
int |
RESULT_ERROR_SESSION_SETUP_REQUIRED
Result code representing that the session needs user's manual intervention. |
int |
RESULT_ERROR_SESSION_SKIP_LIMIT_REACHED
Result code representing that the application cannot skip any more because the skip limit is reached. |
int |
RESULT_ERROR_UNKNOWN
Result code represents that call is ended with an unknown error. |
int |
RESULT_INFO_SKIPPED
Result code representing that the command is skipped or canceled. |
int |
RESULT_SUCCESS
Result code representing that the command is successfully completed. |
Public constructors | |
---|---|
LibraryResult(int resultCode)
Constructor only with the result code. |
|
LibraryResult(int resultCode, MediaItem item, MediaLibraryService.LibraryParams params)
Constructor with the result code and a media item. |
|
LibraryResult(int resultCode, List<MediaItem> items, MediaLibraryService.LibraryParams params)
Constructor with the result code and a list of media items. |
Public methods | |
---|---|
long
|
getCompletionTime()
Gets the completion time of the command. |
MediaLibraryService.LibraryParams
|
getLibraryParams()
Gets the library params |
MediaItem
|
getMediaItem()
Gets the media item. |
List<MediaItem>
|
getMediaItems()
Gets the list of media item. |
int
|
getResultCode()
Gets the result code. |
Inherited methods | |
---|---|
Constants
RESULT_ERROR_BAD_VALUE
public static final int RESULT_ERROR_BAD_VALUE
Result code representing that an argument is illegal.
Constant Value: -3 (0xfffffffd)
RESULT_ERROR_INVALID_STATE
public static final int RESULT_ERROR_INVALID_STATE
Result code representing that the command cannot be completed because the current state is not valid for the command.
Constant Value: -2 (0xfffffffe)
RESULT_ERROR_IO
public static final int RESULT_ERROR_IO
Result code representing a file or network related command error.
Constant Value: -5 (0xfffffffb)
RESULT_ERROR_NOT_SUPPORTED
public static final int RESULT_ERROR_NOT_SUPPORTED
Result code representing that the command is not supported nor implemented.
Constant Value: -6 (0xfffffffa)
RESULT_ERROR_PERMISSION_DENIED
public static final int RESULT_ERROR_PERMISSION_DENIED
Result code representing that the command is not allowed.
Constant Value: -4 (0xfffffffc)
RESULT_ERROR_SESSION_AUTHENTICATION_EXPIRED
public static final int RESULT_ERROR_SESSION_AUTHENTICATION_EXPIRED
Result code representing that the authentication has expired.
Constant Value: -102 (0xffffff9a)
RESULT_ERROR_SESSION_CONCURRENT_STREAM_LIMIT
public static final int RESULT_ERROR_SESSION_CONCURRENT_STREAM_LIMIT
Result code representing that too many concurrent streams are detected.
Constant Value: -104 (0xffffff98)
RESULT_ERROR_SESSION_DISCONNECTED
public static final int RESULT_ERROR_SESSION_DISCONNECTED
Result code representing that the session and controller were disconnected.
Constant Value: -100 (0xffffff9c)
RESULT_ERROR_SESSION_NOT_AVAILABLE_IN_REGION
public static final int RESULT_ERROR_SESSION_NOT_AVAILABLE_IN_REGION
Result code representing that the content is blocked due to being regionally unavailable.
Constant Value: -106 (0xffffff96)
RESULT_ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED
public static final int RESULT_ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED
Result code representing that the content is blocked due to parental controls.
Constant Value: -105 (0xffffff97)
RESULT_ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED
public static final int RESULT_ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED
Result code representing that a premium account is required.
Constant Value: -103 (0xffffff99)
RESULT_ERROR_SESSION_SETUP_REQUIRED
public static final int RESULT_ERROR_SESSION_SETUP_REQUIRED
Result code representing that the session needs user's manual intervention.
Constant Value: -108 (0xffffff94)
RESULT_ERROR_SESSION_SKIP_LIMIT_REACHED
public static final int RESULT_ERROR_SESSION_SKIP_LIMIT_REACHED
Result code representing that the application cannot skip any more because the skip limit is reached.
Constant Value: -107 (0xffffff95)
RESULT_ERROR_UNKNOWN
public static final int RESULT_ERROR_UNKNOWN
Result code represents that call is ended with an unknown error.
Constant Value: -1 (0xffffffff)
RESULT_INFO_SKIPPED
public static final int RESULT_INFO_SKIPPED
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.
Constant Value: 1 (0x00000001)
RESULT_SUCCESS
public static final int RESULT_SUCCESS
Result code representing that the command is successfully completed.
Constant Value: 0 (0x00000000)
Public constructors
LibraryResult
public LibraryResult (int resultCode)
Constructor only with the result code.
For success, use other constructor that you can also return the result.
Parameters | |
---|---|
resultCode |
int : result code
|
LibraryResult
public LibraryResult (int resultCode, MediaItem item, MediaLibraryService.LibraryParams params)
Constructor with the result code and a media item.
Parameters | |
---|---|
resultCode |
int : result code |
item |
MediaItem : a media item. Can be null for error |
params |
MediaLibraryService.LibraryParams : optional library params to describe the returned media item
|
LibraryResult
public LibraryResult (int resultCode, List<MediaItem> items, MediaLibraryService.LibraryParams params)
Constructor with the result code and a list of media items.
Parameters | |
---|---|
resultCode |
int : result code |
items |
List : list of media items. Can be null for error |
params |
MediaLibraryService.LibraryParams : optional library params to describe the returned list of media items.
|
Public methods
getCompletionTime
public long getCompletionTime ()
Gets the completion time of the command. Being more specific, it's the same as
SystemClock.elapsedRealtime()
when the command completed.
Returns | |
---|---|
long |
completion time of the command |
getLibraryParams
public MediaLibraryService.LibraryParams getLibraryParams ()
Gets the library params
Returns | |
---|---|
MediaLibraryService.LibraryParams |
library params. |
getMediaItem
public MediaItem getMediaItem ()
Gets the media item.
Can be null
if an error happened or the command doesn't return a media item.
Returns | |
---|---|
MediaItem |
media item |
getMediaItems
public List<MediaItem> getMediaItems ()
Gets the list of media item.
Can be null
if an error happened or the command doesn't return a list of media
items.
Returns | |
---|---|
List<MediaItem> |
list of media item |
getResultCode
public int getResultCode ()
Gets the result code.
Returns | |
---|---|
int |
result code |
See also:
RESULT_SUCCESS
RESULT_ERROR_UNKNOWN
RESULT_ERROR_INVALID_STATE
RESULT_ERROR_BAD_VALUE
RESULT_ERROR_PERMISSION_DENIED
RESULT_ERROR_IO
RESULT_INFO_SKIPPED
RESULT_ERROR_SESSION_DISCONNECTED
RESULT_ERROR_NOT_SUPPORTED
RESULT_ERROR_SESSION_AUTHENTICATION_EXPIRED
RESULT_ERROR_SESSION_PREMIUM_ACCOUNT_REQUIRED
RESULT_ERROR_SESSION_CONCURRENT_STREAM_LIMIT
RESULT_ERROR_SESSION_PARENTAL_CONTROL_RESTRICTED
RESULT_ERROR_SESSION_NOT_AVAILABLE_IN_REGION
RESULT_ERROR_SESSION_SKIP_LIMIT_REACHED
RESULT_ERROR_SESSION_SETUP_REQUIRED