MediaPlayer2.EventCallback

public static class MediaPlayer2.EventCallback
extends Object

java.lang.Object
   ↳ android.media.MediaPlayer2.EventCallback


Interface definition for callbacks to be invoked when the player has the corresponding events.

Summary

Public constructors

MediaPlayer2.EventCallback()

Public methods

void onCallCompleted(MediaPlayer2 mp, DataSourceDesc dsd, int what, int status)

Called to acknowledge an API call.

void onCommandLabelReached(MediaPlayer2 mp, Object label)

Called to indicate MediaPlayer2.notifyWhenCommandLabelReached(java.lang.Object) has been processed.

void onError(MediaPlayer2 mp, DataSourceDesc dsd, int what, int extra)

Called to indicate an error.

void onInfo(MediaPlayer2 mp, DataSourceDesc dsd, int what, int extra)

Called to indicate an info or a warning.

void onMediaTimeDiscontinuity(MediaPlayer2 mp, DataSourceDesc dsd, MediaTimestamp timestamp)

Called to indicate media clock has changed.

void onSubtitleData(MediaPlayer2 mp, DataSourceDesc dsd, SubtitleData data)

Called when when a player subtitle track has new subtitle data available.

void onTimedMetaDataAvailable(MediaPlayer2 mp, DataSourceDesc dsd, TimedMetaData data)

Called to indicate avaliable timed metadata

This method will be called as timed metadata is extracted from the media, in the same order as it occurs in the media.

void onVideoSizeChanged(MediaPlayer2 mp, DataSourceDesc dsd, Size size)

Called to indicate the video size The video size (width and height) could be 0 if there was no video, no display surface was set, or the value was not determined yet.

Inherited methods

Public constructors

MediaPlayer2.EventCallback

public MediaPlayer2.EventCallback ()

Public methods

onCallCompleted

public void onCallCompleted (MediaPlayer2 mp, 
                DataSourceDesc dsd, 
                int what, 
                int status)

Called to acknowledge an API call.

Parameters
mp MediaPlayer2: the MediaPlayer2 the call was made on. This value must never be null.

dsd DataSourceDesc: the DataSourceDesc of this data source This value must never be null.

what int: the enum for the API call. Value is MediaPlayer2.CALL_COMPLETED_ATTACH_AUX_EFFECT, MediaPlayer2.CALL_COMPLETED_DESELECT_TRACK, MediaPlayer2.CALL_COMPLETED_LOOP_CURRENT, MediaPlayer2.CALL_COMPLETED_PAUSE, MediaPlayer2.CALL_COMPLETED_PLAY, MediaPlayer2.CALL_COMPLETED_PREPARE, MediaPlayer2.CALL_COMPLETED_SEEK_TO, MediaPlayer2.CALL_COMPLETED_SELECT_TRACK, MediaPlayer2.CALL_COMPLETED_SET_AUDIO_ATTRIBUTES, MediaPlayer2.CALL_COMPLETED_SET_AUDIO_SESSION_ID, MediaPlayer2.CALL_COMPLETED_SET_AUX_EFFECT_SEND_LEVEL, MediaPlayer2.CALL_COMPLETED_SET_DATA_SOURCE, MediaPlayer2.CALL_COMPLETED_SET_NEXT_DATA_SOURCE, MediaPlayer2.CALL_COMPLETED_SET_NEXT_DATA_SOURCES, MediaPlayer2.CALL_COMPLETED_SET_PLAYBACK_PARAMS, MediaPlayer2.CALL_COMPLETED_SET_PLAYER_VOLUME, MediaPlayer2.CALL_COMPLETED_SET_SURFACE, MediaPlayer2.CALL_COMPLETED_SET_SYNC_PARAMS, MediaPlayer2.CALL_COMPLETED_SKIP_TO_NEXT, MediaPlayer2.CALL_COMPLETED_CLEAR_NEXT_DATA_SOURCES, android.media.MediaPlayer2.CALL_COMPLETED_SET_BUFFERING_PARAMS, MediaPlayer2.CALL_COMPLETED_SET_DISPLAY, MediaPlayer2.CALL_COMPLETED_SET_WAKE_LOCK, MediaPlayer2.CALL_COMPLETED_SET_SCREEN_ON_WHILE_PLAYING, android.media.MediaPlayer2.CALL_COMPLETED_NOTIFY_WHEN_COMMAND_LABEL_REACHED, or android.media.MediaPlayer2.CALL_COMPLETED_PREPARE_DRM

status int: the returned status code for the call. Value is MediaPlayer2.CALL_STATUS_NO_ERROR, MediaPlayer2.CALL_STATUS_ERROR_UNKNOWN, MediaPlayer2.CALL_STATUS_INVALID_OPERATION, MediaPlayer2.CALL_STATUS_BAD_VALUE, MediaPlayer2.CALL_STATUS_PERMISSION_DENIED, MediaPlayer2.CALL_STATUS_ERROR_IO, MediaPlayer2.CALL_STATUS_SKIPPED, or MediaPlayer2.CALL_STATUS_NO_DRM_SCHEME

onCommandLabelReached

public void onCommandLabelReached (MediaPlayer2 mp, 
                Object label)

Called to indicate MediaPlayer2.notifyWhenCommandLabelReached(java.lang.Object) has been processed.

Parameters
mp MediaPlayer2: the MediaPlayer2 MediaPlayer2.notifyWhenCommandLabelReached(java.lang.Object) was called on. This value must never be null.

label Object: the application specific Object given by MediaPlayer2.notifyWhenCommandLabelReached(java.lang.Object). This value must never be null.

onError

public void onError (MediaPlayer2 mp, 
                DataSourceDesc dsd, 
                int what, 
                int extra)

Called to indicate an error.

Parameters
mp MediaPlayer2: the MediaPlayer2 the error pertains to This value must never be null.

dsd DataSourceDesc: the DataSourceDesc of this data source This value must never be null.

what int: the type of error that has occurred. Value is MediaPlayer2.MEDIA_ERROR_UNKNOWN, MediaPlayer2.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK, MediaPlayer2.MEDIA_ERROR_IO, MediaPlayer2.MEDIA_ERROR_MALFORMED, MediaPlayer2.MEDIA_ERROR_UNSUPPORTED, MediaPlayer2.MEDIA_ERROR_TIMED_OUT, or android.media.MediaPlayer2.MEDIA_ERROR_SYSTEM

extra int: an extra code, specific to the error. Typically implementation dependent.

onInfo

public void onInfo (MediaPlayer2 mp, 
                DataSourceDesc dsd, 
                int what, 
                int extra)

Called to indicate an info or a warning.

Parameters
mp MediaPlayer2: the MediaPlayer2 the info pertains to. This value must never be null.

dsd DataSourceDesc: the DataSourceDesc of this data source This value must never be null.

what int: the type of info or warning. Value is MediaPlayer2.MEDIA_INFO_UNKNOWN, MediaPlayer2.MEDIA_INFO_DATA_SOURCE_START, MediaPlayer2.MEDIA_INFO_VIDEO_RENDERING_START, MediaPlayer2.MEDIA_INFO_AUDIO_RENDERING_START, MediaPlayer2.MEDIA_INFO_DATA_SOURCE_END, MediaPlayer2.MEDIA_INFO_DATA_SOURCE_LIST_END, MediaPlayer2.MEDIA_INFO_PREPARED, MediaPlayer2.MEDIA_INFO_VIDEO_TRACK_LAGGING, MediaPlayer2.MEDIA_INFO_BUFFERING_START, MediaPlayer2.MEDIA_INFO_BUFFERING_END, android.media.MediaPlayer2.MEDIA_INFO_NETWORK_BANDWIDTH, MediaPlayer2.MEDIA_INFO_BUFFERING_UPDATE, MediaPlayer2.MEDIA_INFO_BAD_INTERLEAVING, MediaPlayer2.MEDIA_INFO_NOT_SEEKABLE, MediaPlayer2.MEDIA_INFO_METADATA_UPDATE, MediaPlayer2.MEDIA_INFO_AUDIO_NOT_PLAYING, MediaPlayer2.MEDIA_INFO_VIDEO_NOT_PLAYING, android.media.MediaPlayer2.MEDIA_INFO_TIMED_TEXT_ERROR, MediaPlayer2.MEDIA_INFO_UNSUPPORTED_SUBTITLE, or MediaPlayer2.MEDIA_INFO_SUBTITLE_TIMED_OUT

extra int: an extra code, specific to the info. Typically implementation dependent.

onMediaTimeDiscontinuity

public void onMediaTimeDiscontinuity (MediaPlayer2 mp, 
                DataSourceDesc dsd, 
                MediaTimestamp timestamp)

Called to indicate media clock has changed.

Parameters
mp MediaPlayer2: the MediaPlayer2 the media time pertains to. This value must never be null.

dsd DataSourceDesc: the DataSourceDesc of this data source This value must never be null.

timestamp MediaTimestamp: the new media clock. This value must never be null.

onSubtitleData

public void onSubtitleData (MediaPlayer2 mp, 
                DataSourceDesc dsd, 
                SubtitleData data)

Called when when a player subtitle track has new subtitle data available.

Parameters
mp MediaPlayer2: the player that reports the new subtitle data This value must never be null.

dsd DataSourceDesc: the DataSourceDesc of this data source This value must never be null.

data SubtitleData: the subtitle data This value must never be null.

onTimedMetaDataAvailable

public void onTimedMetaDataAvailable (MediaPlayer2 mp, 
                DataSourceDesc dsd, 
                TimedMetaData data)

Called to indicate avaliable timed metadata

This method will be called as timed metadata is extracted from the media, in the same order as it occurs in the media. The timing of this event is not controlled by the associated timestamp.

Currently only HTTP live streaming data URI's embedded with timed ID3 tags generates TimedMetaData.

Parameters
mp MediaPlayer2: the MediaPlayer2 associated with this callback This value must never be null.

dsd DataSourceDesc: the DataSourceDesc of this data source This value must never be null.

data TimedMetaData: the timed metadata sample associated with this event This value must never be null.

onVideoSizeChanged

public void onVideoSizeChanged (MediaPlayer2 mp, 
                DataSourceDesc dsd, 
                Size size)

Called to indicate the video size The video size (width and height) could be 0 if there was no video, no display surface was set, or the value was not determined yet.

Parameters
mp MediaPlayer2: the MediaPlayer2 associated with this callback This value must never be null.

dsd DataSourceDesc: the DataSourceDesc of this data source This value must never be null.

size Size: the size of the video This value must never be null.