IviMediaItem

@IviExperimental(reasons = [])
data class IviMediaItem : Parcelable

A basic data structure used to communicate information about an element in the media domain. This element can represent different types of items, from a song to an album to a dashboard representing the content of a media source.

Media items are created by their media source. The source determines which metadata is available.

Constructed using the IviMediaItemBuilder.

The isBrowsable and isPlayable state of a MediaItem determines its role. For example, in a media browsing UI, a browsable IviMediaItem can usually be clicked to see its contents; songs are just playable IviMediaItems, while albums and playlists are both playable and browsable. Normally, at least one of those two flags should be set.

Parameters

id

The identification of this media item. This value is specific to the source providing the content. This should be a persistent key for the underlying content. If a source did not provide any identification, it contains an empty string.

isBrowsable

Whether it's possible to browse the children of this media item.

isPlayable

Whether it's possible to play this media item.

metadata

Contains the metadata of this media item, like the artist or the media art URI. All values are optional.

Properties

Link copied to clipboard

The media album. Is null if it has no set album.

Link copied to clipboard

The media artist, or media album artist. Is null if it has no set artist.

Link copied to clipboard
val artUri: Uri?

The media item art Uri, prioritized for usage in larger spaces. Will fall back to icon sized artwork when no high resolution property is found.

Link copied to clipboard

The hint for the style of a browsable media item, if specified; null otherwise.

Link copied to clipboard

The media compilation name. Is null if it has no set compilation.

Link copied to clipboard

The media's composer. Is null if it has no set composer.

Link copied to clipboard

The description of a media item. Is null if it has no set description.

Link copied to clipboard

The duration of a media item. When the media item has no duration or the duration is negative, duration will be zero.

Link copied to clipboard

The genre of a media item. Is null if it has no set genre.

Link copied to clipboard

The hint for the group title of a media item. Is null if it has no set group title hint.

Link copied to clipboard

The media item art Uri, prioritized for usage as an icon. Will fall back to larger sized artwork when no low resolution property found.

Link copied to clipboard
val id: String
Link copied to clipboard
Link copied to clipboard

Whether this media item is marked as containing explicit content.

Link copied to clipboard
Link copied to clipboard

The media item Uri string representation. Is null when Uri is not set or empty. This value is specific to the source providing the content.

Link copied to clipboard

The hint for the style of a playable media item, if specified; null otherwise.

Link copied to clipboard

The rating assigned to this media item.

Link copied to clipboard

The subtitle of a media item. Is null if it has no set subtitle.

Link copied to clipboard

The display title or title of a media item. Is null if it has no set title or display title.

Link copied to clipboard

The media item's writer. Is null if it has no set writer.

Functions

Link copied to clipboard

Whether the key is present in the metadata.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Custom equals method to include comparing the contents of the metadata.

Link copied to clipboard

Gets the key from the metadata as a boolean.

Link copied to clipboard
fun getFloat(key: String): Float?

Gets the key from the metadata as a float.

Link copied to clipboard
fun getInt(key: String): Int?

Gets the key from the metadata as an int.

Link copied to clipboard
fun getLong(key: String): Long?

Gets the key from the metadata as a long.

Link copied to clipboard
fun getString(key: String): String?

Gets the key from the metadata as a string.

Link copied to clipboard
open override fun hashCode(): Int

Custom hashCode method to include hashing the contents of the metadata.

Link copied to clipboard
open override fun toString(): String

Inherited functions

Link copied to clipboard
abstract fun describeContents(): Int
Link copied to clipboard
abstract fun writeToParcel(p0: Parcel, p1: Int)