Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

OnDataSourceMissingHelper

interface OnDataSourceMissingHelper
androidx.media2.MediaSession2.OnDataSourceMissingHelper

Interface definition of a callback to be invoked when a MediaItem2 in the playlist didn't have a DataSourceDesc2 but it's needed now for preparing or playing it. #see #setOnDataSourceMissingHelper

Summary

Public methods
abstract DataSourceDesc2?
onDataSourceMissing(@NonNull session: MediaSession2, @NonNull item: MediaItem2)

Called when a MediaItem2 in the playlist didn't have a DataSourceDesc2 but it's needed now for preparing or playing it.

Public methods

onDataSourceMissing

@Nullable abstract fun onDataSourceMissing(@NonNull session: MediaSession2, @NonNull item: MediaItem2): DataSourceDesc2?

Called when a MediaItem2 in the playlist didn't have a DataSourceDesc2 but it's needed now for preparing or playing it. Returned data source descriptor will be sent to the player directly to prepare or play the contents.

An exception may be thrown if the returned DataSourceDesc2 is duplicated in the playlist, so items cannot be differentiated.

Parameters
session MediaSession2: the session for this event
item MediaSession2: media item from the controller
Return
DataSourceDesc2?: a data source descriptor if the media item. Can be null if the content isn't available.