LibraryResult
open class LibraryResult : CustomVersionedParcelable, RemoteResult
androidx.media2.session.LibraryResult |
Result class to be used with ListenableFuture
for asynchronous calls between MediaLibraryService.MediaLibrarySession
and MediaBrowser
.
Summary
Public constructors |
|
---|---|
Constructor only with the result code. |
|
<init>(resultCode: Int, @Nullable item: MediaItem?, @Nullable params: MediaLibraryService.LibraryParams?) Constructor with the result code and a media item. |
|
<init>(resultCode: Int, @Nullable items: MutableList<MediaItem!>?, @Nullable params: MediaLibraryService.LibraryParams?) Constructor with the result code and a list of media items. |
Public methods |
|
---|---|
open Long |
Gets the completion time of the command. |
open MediaLibraryService.LibraryParams? |
Gets the library params |
open MediaItem? |
Gets the media item. |
open MutableList<MediaItem!>? |
Gets the list of media item. |
open Int |
Gets the result code. |
Public constructors
<init>
LibraryResult(resultCode: Int)
Constructor only with the result code.
For success, use other constructor that you can also return the result.
Parameters | |
---|---|
resultCode |
Int: result code |
<init>
LibraryResult(resultCode: Int, @Nullable item: MediaItem?, @Nullable params: MediaLibraryService.LibraryParams?)
Constructor with the result code and a media item.
Parameters | |
---|---|
resultCode |
Int: result code |
item |
Int: a media item. Can be null for error |
params |
Int: optional library params to describe the returned media item |
<init>
LibraryResult(resultCode: Int, @Nullable items: MutableList<MediaItem!>?, @Nullable params: MediaLibraryService.LibraryParams?)
Constructor with the result code and a list of media items.
Parameters | |
---|---|
resultCode |
Int: result code |
items |
Int: list of media items. Can be null for error |
params |
Int: optional library params to describe the returned list of media items. |
Public methods
getCompletionTime
open fun getCompletionTime(): Long
Gets the completion time of the command. Being more specific, it's the same as android.os.SystemClock#elapsedRealtime()
when the command completed.
Return | |
---|---|
Long: completion time of the command |
getLibraryParams
@Nullable open fun getLibraryParams(): MediaLibraryService.LibraryParams?
Gets the library params
Return | |
---|---|
MediaLibraryService.LibraryParams?: library params. |
getMediaItem
@Nullable open fun getMediaItem(): MediaItem?
Gets the media item.
Can be null
if an error happened or the command doesn't return a media item.
Return | |
---|---|
MediaItem?: media item |
getMediaItems
@Nullable open fun getMediaItems(): MutableList<MediaItem!>?
Gets the list of media item.
Can be null
if an error happened or the command doesn't return a list of media items.
Return | |
---|---|
MutableList<MediaItem!>?: list of media item |
getResultCode
open fun getResultCode(): Int
Gets the result code.
Return | |
---|---|
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