Package com.tomtom.ivi.appsuite.media.api.common.core

The main package of the media library. This provides the core facilities for browsing media.

The main entry point of the library are source clients. A SourceClient instance abstracts an Android MediaBrowser instance, to ease its usage to the maximum while providing the full functionality.

The library provides source clients to use in different contexts:

  • RootSourceClient. A source client to show and browse the content tree of a media source. It provides access to a source's categories (the top-level items used to access all available contents), and loads the media items in those. It can also load (browse) any of the loaded items: this which will replace all previously loaded items.

  • ItemSourceClient. A source client showing the contents of a single browsable media item, for example a set list of radio stations or a playlist.

  • SearchSourceClient. A source client to search the content tree of a media source. The media source needs to support this functionality for search to be possible.

All source clients have status callbacks, ErrorCallback, to react to different situations occurring in the remote media source or the library.

The source clients use SourceId to identify a specific media source. They deliver their results via their contents field, in the form of IviMediaItems. An IviMediaItem is a basic data structure used to communicate information about an element in the media domain. It can represent anything from a song to an album to a dashboard grouping all content of a media source.

Types

Link copied to clipboard
enum ContentStyle : Enum<ContentStyle>

Specifies a content style (a suggested presentation layout) of media items within the browse tree. Represents values for MediaBundleExtras.EXTRA_CONTENT_STYLE_BROWSABLE_HINT and MediaBundleExtras.EXTRA_CONTENT_STYLE_PLAYABLE_HINT.

Link copied to clipboard
abstract class ErrorCallback

Container for callbacks for various error conditions.

Link copied to clipboard
class ItemSourceClient(    sourceId: SourceId,     val mediaItem: IviMediaItem,     coroutineDispatcher: CoroutineDispatcher = Options.mediaCoroutineDispatcher) : SourceClient

A SourceClient specialization oriented towards showing the contents of a single media item.

Link copied to clipboard
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.

Link copied to clipboard
class IviMediaItemBuilder

A builder that creates IviMediaItems.

Link copied to clipboard
class IviMediaRating(val type: IviMediaRating.Type = Type.UNSUPPORTED, initialValue: Float = UNRATED) : Serializable

Rating assigned to an IviMediaItem.

Link copied to clipboard
enum IviPlaybackState : Enum<IviPlaybackState> , Parcelable

The current state of playback for a given media source.

Link copied to clipboard
object MediaBundleExtras

Names of extras for Bundle to access IviMediaItem data and StandardActionId.

Link copied to clipboard
data class MediaPlaybackTimeInfo(    val duration: Duration? = null,     val position: Duration? = null,     val playbackSpeed: Float = INVALID_PLAYBACK_SPEED,     val lastPositionUpdateTime: Duration = getElapsedTime()) : Parcelable

Information about a media timeline, such as duration, playing position, and playback speed.

Link copied to clipboard
object Options

Global run-time options for media library components.

Link copied to clipboard
enum ResultCode : Enum<ResultCode>

Media result codes, coming from library components. These can be used to recognize errors and special notifications coming from media sources.

Link copied to clipboard
class RootSourceClient(sourceId: SourceId, coroutineDispatcher: CoroutineDispatcher = Options.mediaCoroutineDispatcher) : SourceClient

SourceClient specialization for showing the content of the root of a media source's browsing hierarchy. It provides access to a source's categories (the top-level items used to access all available content), and can be instructed to browse through any of the available content.

Link copied to clipboard
class SearchSourceClient(sourceId: SourceId, coroutineDispatcher: CoroutineDispatcher = Options.mediaCoroutineDispatcher) : SourceClient

SourceClient specialization oriented towards searching.

Link copied to clipboard
interface SourceClient

A client to browse content offered by a media source.

Link copied to clipboard
open class SourceId(val packageName: String, val className: String) : Parcelable

Unique identifier for a media source.

Link copied to clipboard
data class SourceInfo(    val id: SourceId,     val displayName: String,     val icon: Icon,     val isReady: Boolean,     val loginIntent: PendingIntent? = null) : Parcelable

Information about a media source.

Functions

Link copied to clipboard
fun List<IviMediaItem>?.containsId(mediaId: String): Boolean

Returns whether this list of IviMediaItems contains an item with the given mediaId.

Link copied to clipboard
fun List<IviMediaItem>.dump(): String

Returns the entire contents of a list of IviMediaItems as a string. Useful for debugging, to know the exact contents of a source's data set.

Link copied to clipboard
fun List<IviMediaItem>?.findOrNull(mediaId: String): IviMediaItem?

Returns the first IviMediaItem with the given mediaId in this list; null otherwise.

Link copied to clipboard
fun Bundle.getBrowsableHint(): ContentStyle?

Gets a presentation hint for browsable items.

Link copied to clipboard
fun getElapsedTime(): Duration

Returns the elapsed time to be compared with MediaPlaybackTimeInfo.lastPositionUpdateTime.

Link copied to clipboard
fun Bundle.getPlayableHint(): ContentStyle?

Gets a presentation hint for playable items.