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>(description: MediaDescriptionCompat, flags: Int)

Create a new MediaItem for use in browsing media.

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

open Boolean

Returns whether this item is playable.

open String

open MediaDescriptionCompat

Returns the description of the media.

open Boolean

Returns whether this item is browsable.

open Int

Gets the flags of the item.

open Int

open String?

Returns the media id in the MediaDescriptionCompat for this item.

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.

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

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: 2

Public constructors

<init>

MediaItem(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

writeToParcel

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

isPlayable

open fun isPlayable(): Boolean

Returns whether this item is playable.

See Also

toString

open fun toString(): String

getDescription

open fun getDescription(): MediaDescriptionCompat

Returns the description of the media.

isBrowsable

open fun isBrowsable(): Boolean

Returns whether this item is browsable.

See Also

getFlags

open fun getFlags(): Int

Gets the flags of the item.

describeContents

open fun describeContents(): Int

getMediaId

open fun getMediaId(): String?

Returns the media id in the MediaDescriptionCompat for this item.

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.

Properties

CREATOR

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