MediaItem

class MediaItem : Parcelable
kotlin.Any
   ↳ android.support.v4.media.MediaBrowserCompat.MediaItem

A class with information on a single media item for use in browsing/searching media. MediaItems are application dependent so we cannot guarantee that they contain the right values.

Summary

Constants

static Int

Flag: Indicates that the item has children of its own.

static Int

Flag: Indicates that the item is playable.

Public constructors

<init>(@NonNull description: MediaDescriptionCompat, flags: Int)

Create a new MediaItem for use in browsing media.

Public methods

open Int

open static MediaBrowserCompat.MediaItem!
fromMediaItem(itemObj: Any!)

Creates an instance from a framework android.media.browse.MediaBrowser.MediaItem object.

open static MutableList<MediaBrowserCompat.MediaItem!>!

Creates a list of MediaItem objects from a framework android.media.browse.MediaBrowser.MediaItem object list.

open MediaDescriptionCompat

Returns the description of the media.

open Int

Gets the flags of the item.

open String?

Returns the media id in the MediaDescriptionCompat for this item.

open Boolean

Returns whether this item is browsable.

open Boolean

Returns whether this item is playable.

open String

open Unit
writeToParcel(out: Parcel!, flags: Int)

Properties

static Creator<MediaBrowserCompat.MediaItem!>!

Constants

FLAG_BROWSABLE

static val FLAG_BROWSABLE: Int

Flag: Indicates that the item has children of its own.

Value: 1 << 0

FLAG_PLAYABLE

static val FLAG_PLAYABLE: Int

Flag: Indicates that the item is playable.

The id of this item may be passed to TransportControls#playFromMediaId(String, Bundle) to start playing it.

Value: 1 << 1

Public constructors

<init>

MediaItem(@NonNull description: MediaDescriptionCompat, flags: Int)

Create a new MediaItem for use in browsing media.

Parameters
description MediaDescriptionCompat: The description of the media, which must include a media id.
flags MediaDescriptionCompat: The flags for this item.

Public methods

describeContents

open fun describeContents(): Int

fromMediaItem

open static fun fromMediaItem(itemObj: Any!): MediaBrowserCompat.MediaItem!

Creates an instance from a framework android.media.browse.MediaBrowser.MediaItem object.

This method is only supported on API 21+. On API 20 and below, it returns null.

Parameters
itemObj Any!: A android.media.browse.MediaBrowser.MediaItem object.
Return
MediaBrowserCompat.MediaItem!: An equivalent MediaItem object, or null if none.

fromMediaItemList

open static fun fromMediaItemList(itemList: MutableList<*>!): MutableList<MediaBrowserCompat.MediaItem!>!

Creates a list of MediaItem objects from a framework android.media.browse.MediaBrowser.MediaItem object list.

This method is only supported on API 21+. On API 20 and below, it returns null.

Parameters
itemList MutableList<*>!: A list of android.media.browse.MediaBrowser.MediaItem objects.
Return
MutableList<MediaBrowserCompat.MediaItem!>!: An equivalent list of MediaItem objects, or null if none.

getDescription

@NonNull open fun getDescription(): MediaDescriptionCompat

Returns the description of the media.

getFlags

open fun getFlags(): Int

Gets the flags of the item.

getMediaId

@Nullable open fun getMediaId(): String?

Returns the media id in the MediaDescriptionCompat for this item.

isBrowsable

open fun isBrowsable(): Boolean

Returns whether this item is browsable.

See Also

isPlayable

open fun isPlayable(): Boolean

Returns whether this item is playable.

See Also

toString

open fun toString(): String

writeToParcel

open fun writeToParcel(out: Parcel!, flags: Int): Unit

Properties

CREATOR

static val CREATOR: Creator<MediaBrowserCompat.MediaItem!>!