Skip to main content
Version: 14 Oct 2024

ml_media_player.h

Classes

Name
structMLMediaPlayerTrackDRMInfo
MediaPlayer DRM Info for a Media Track .
structMLMediaPlayerSubtitleData
structMLMediaPlayerBufferingSettings
structMLMediaPlayerOnBufferingUpdateInfo
MediaPlayer Buffering update callback Info.
structMLMediaPlayerOnCompletionInfo
MediaPlayer Playback completion callback Info.
structMLMediaPlayerOnErrorInfo
MediaPlayer Error callback Info.
structMLMediaPlayerOnInfoInfo
MediaPlayer Information callback Info.
structMLMediaPlayerOnPreparedInfo
MediaPlayer Playback prepared callback Info.
structMLMediaPlayerOnSeekCompleteInfo
MediaPlayer Playback seek completion callback Info.
structMLMediaPlayerOnVideoSizeChangedInfo
MediaPlayer Video Size Changed callback Info.
structMLMediaPlayerOnTrackDRMInfo
MediaPlayer Track DRM Info callback Info.
structMLMediaPlayerOnResetCompleteInfo
MediaPlayer reset completion callback Info.
structMLMediaPlayerOnFramePackingInfo
MediaPlayer frame packing callback Info.
structMLMediaPlayerEventCallbacksEx
Callbacks for notifying client about Media Player error events.
structMLMediaPlayerTrackInfo
MediaPlayer Track Information.
structMLMediaPlayerTrackDRMSessionInfo
DRM Session information for a MediaPlayer Track.
structMLMediaPlayerMetrics
MediaPlayer metrics data.

Types

Name
typedef MLPSSHEntryMLMediaPlayerPSSHEntry
typedef struct MLMediaPlayerTrackDRMInfoMLMediaPlayerTrackDRMInfo
MediaPlayer DRM Info for a Media Track .
typedef struct MLMediaPlayerSubtitleDataMLMediaPlayerSubtitleData
typedef struct MLMediaPlayerBufferingSettingsMLMediaPlayerBufferingSettings
typedef struct MLMediaPlayerOnBufferingUpdateInfoMLMediaPlayerOnBufferingUpdateInfo
MediaPlayer Buffering update callback Info.
typedef struct MLMediaPlayerOnCompletionInfoMLMediaPlayerOnCompletionInfo
MediaPlayer Playback completion callback Info.
typedef struct MLMediaPlayerOnErrorInfoMLMediaPlayerOnErrorInfo
MediaPlayer Error callback Info.
typedef struct MLMediaPlayerOnInfoInfoMLMediaPlayerOnInfoInfo
MediaPlayer Information callback Info.
typedef struct MLMediaPlayerOnPreparedInfoMLMediaPlayerOnPreparedInfo
MediaPlayer Playback prepared callback Info.
typedef struct MLMediaPlayerOnSeekCompleteInfoMLMediaPlayerOnSeekCompleteInfo
MediaPlayer Playback seek completion callback Info.
typedef struct MLMediaPlayerOnVideoSizeChangedInfoMLMediaPlayerOnVideoSizeChangedInfo
MediaPlayer Video Size Changed callback Info.
typedef struct MLMediaPlayerOnTrackDRMInfoMLMediaPlayerOnTrackDRMInfo
MediaPlayer Track DRM Info callback Info.
typedef struct MLMediaPlayerOnResetCompleteInfoMLMediaPlayerOnResetCompleteInfo
MediaPlayer reset completion callback Info.
typedef struct MLMediaPlayerOnFramePackingInfoMLMediaPlayerOnFramePackingInfo
MediaPlayer frame packing callback Info.
typedef struct MLMediaPlayerEventCallbacksExMLMediaPlayerEventCallbacksEx
Callbacks for notifying client about Media Player error events.
typedef struct MLMediaPlayerTrackInfoMLMediaPlayerTrackInfo
MediaPlayer Track Information.
typedef struct MLMediaPlayerTrackDRMSessionInfoMLMediaPlayerTrackDRMSessionInfo
DRM Session information for a MediaPlayer Track.
typedef void()(MLHandle media_player, MLMediaPlayerSubtitleData subtitle_data, void data)MLMediaPlayerOnMediaSubtitleUpdateCallback
Callbacks signature called when subtitle update is available.
typedef void()(MLHandle media_player, MLHandle timed_text, void data)MLMediaPlayerOnMediaTimedTextUpdateCallback
Callbacks signature called when Timed Text update is available.
typedef struct MLMediaPlayerMetricsMLMediaPlayerMetrics
MediaPlayer metrics data.

Enums

Name
enumMLMediaPlayerVideoScalingMode
{
MLMediaPlayerVideoScalingMode_ScaleToFit = 1,
MLMediaPlayerVideoScalingMode_ScaleToFitWithCropping = 2,
MLMediaPlayerVideoScalingMode_Ensure32Bits = 0x7FFFFFFF
}
enumMLMediaPlayerPollingStateFlags
{
MLMediaPlayerPollingStateFlag_IsPlaying = 1 << 0,
MLMediaPlayerPollingStateFlag_IsLooping = 1 << 1,
MLMediaPlayerPollingStateFlag_HasBeenPrepared = 1 << 2,
MLMediaPlayerPollingStateFlag_HasPlaybackCompleted = 1 << 3,
MLMediaPlayerPollingStateFlag_HasSeekCompleted = 1 << 4,
MLMediaPlayerPollingStateFlag_HasSizeChanged = 1 << 5,
MLMediaPlayerPollingStateFlag_HasBufferingUpdated = 1 << 6,
MLMediaPlayerPollingStateFlag_HasReceivedInfo = 1 << 7,
MLMediaPlayerPollingStateFlag_HasReceivedError = 1 << 8,
MLMediaPlayerPollingStateFlag_HasTimedTextUpdated = 1 << 9,
MLMediaPlayerPollingStateFlag_HasSubtitleUpdated = 1 << 10,
MLMediaPlayerPollingStateFlag_HasMetadataUpdated = 1 << 11,
MLMediaPlayerPollingStateFlag_HasDrmInfoUpdated = 1 << 12,
MLMediaPlayerPollingStateFlag_HasResetCompleted = 1 << 13,
MLMediaPlayerPollingStateFlag_Ensure32Bits = 0x7FFFFFFF
}
enumMLMediaPlayerInfo
{
MLMediaPlayerInfo_Unknown = 1,
MLMediaPlayerInfo_StartedAsNext = 2,
MLMediaPlayerInfo_RenderingStart = 3,
MLMediaPlayerInfo_Looping = 4,
MLMediaPlayerInfo_Started = 5,
MLMediaPlayerInfo_Paused = 6,
MLMediaPlayerInfo_Stopped = 7,
MLMediaPlayerInfo_StartedBySharedPlayer = 8,
MLMediaPlayerInfo_PausedBySharedPlayer = 9,
MLMediaPlayerInfo_SeekBySharedPlayer = 10,
MLMediaPlayerInfo_StoppedBySharedPlayer = 11,
MLMediaPlayerInfo_SyncStart = 12,
MLMediaPlayerInfo_SyncComplete = 13,
MLMediaPlayerInfo_VideoTrackLagging = 700,
MLMediaPlayerInfo_BufferingStart = 701,
MLMediaPlayerInfo_BufferingEnd = 702,
MLMediaPlayerInfo_NetworkBandwidth = 703,
MLMediaPlayerInfo_BehindLiveWindow = 704,
MLMediaPlayerInfo_PowerStatePause = 705,
MLMediaPlayerInfo_PowerStateResume = 706,
MLMediaPlayerInfo_BufferedDuration = 707,
MLMediaPlayerInfo_BadInterleaving = 800,
MLMediaPlayerInfo_NotSeekable = 801,
MLMediaPlayerInfo_MetadataUpdate = 802,
MLMediaPlayerInfo_PlayAudioError = 804,
MLMediaPlayerInfo_PlayVideoError = 805,
MLMediaPlayerInfo_TimedTextError = 900,
MLMediaPlayerInfo_Ensure32Bits = 0x7FFFFFFF
}
Info and warning codes for the media player framework.
enumMLMediaPlayerTrackType
{
MLMediaPlayerTrackType_Unknown = 0,
MLMediaPlayerTrackType_Video = 1,
MLMediaPlayerTrackType_Audio = 2,
MLMediaPlayerTrackType_TimedText = 3,
MLMediaPlayerTrackType_Subtitle = 4,
MLMediaPlayerTrackType_Metadata = 5,
MLMediaPlayerTrackType_Ensure32Bits = 0x7FFFFFFF
}
enumMLMediaPlayerBufferingMode
{
MLMediaPlayerBufferingMode_None = 0,
MLMediaPlayerBufferingMode_TimeOnly = 1,
MLMediaPlayerBufferingMode_SizeOnly = 2,
MLMediaPlayerBufferingMode_TimeThenSize = 3,
MLMediaPlayerBufferingMode_Count = 4,
MLMediaPlayerBufferingMode_Ensure32Bits = 0x7FFFFFFF
}
enumMLMediaFramePackingMode
{
MLMediaFramePackingMode_None = 0,
MLMediaFramePackingMode_Checkboard,
MLMediaFramePackingMode_ColumnInterleaved,
MLMediaFramePackingMode_RowInterleaved,
MLMediaFramePackingMode_SideBySideQuincunx,
MLMediaFramePackingMode_SideBySide,
MLMediaFramePackingMode_TopBottom,
MLMediaFramePackingMode_MultiviewFrameByFrame,
MLMediaFramePackingMode_FrameByFrame,
MLMediaFramePackingMode_Anaglyph
}
Frame Packing Arrangement for stereoscopic videos.
enumMLMediaFramePackingFlags
{
MLMediaFramePackingFlags_None = 0,
MLMediaFramePackingFlags_RightViewFirst = 1 << 0,
MLMediaFramePackingFlags_LeftFlipped = 1 << 1,
MLMediaFramePackingFlags_RightFlipped = 1 << 2,
MLMediaFramePackingFlags_Anaglyph_RedCyan = 1 << 3,
MLMediaFramePackingFlags_Anaglyph_GreenMagenta = 1 << 4
}
Frame Packing Arrangement flags for stereoscopic videos.

Functions

Name
voidMLMediaPlayerEventCallbacksExInit(MLMediaPlayerEventCallbacksEx * inout_callbacks)
Initializes MediaPlayerEventCallbacks with default values.
voidMLMediaPlayerTrackInfoInit(MLMediaPlayerTrackInfo * inout_track_info)
Initializes Media Track Information with default values.
voidMLMediaPlayerTrackDRMSessionInfoInit(MLMediaPlayerTrackDRMSessionInfo * inout_drm_session_info)
Initializes Media Track DRM Session Information with defult values.
MLResultMLMediaPlayerCreate(MLHandle * out_handle)
Create a new Media Player object.
MLResultMLMediaPlayerDestroy(MLHandle media_player)
Destroys a MediaPlayer object.
MLResultMLMediaPlayerSetDataSourceForFD(MLHandle media_player, int32_t fd)
Sets a file descriptor as the data source.
MLResultMLMediaPlayerSetOffsetDataSourceForFD(MLHandle media_player, int32_t fd, int64_t offset, int64_t length)
Sets a file descriptor as the data source with offset.
MLResultMLMediaPlayerSetDataSourceForPath(MLHandle media_player, const char * path)
Sets a local file path as the data source.
MLResultMLMediaPlayerSetDataSourceForURI(MLHandle media_player, const char * uri)
Sets a URI string as the data source.
MLResultMLMediaPlayerSetRemoteDataSourceForURI(MLHandle media_player, const char * uri, char ** headers, size_t len)
Sets a URI string as the remote data source.
MLResultMLMediaPlayerSetMediaDataSource(MLHandle media_player, MLHandle media_data_source)
Sets the data source to use.
MLResultMLMediaPlayerSetMediaStreamSource(MLHandle media_player, MLHandle media_stream_source)
Sets the data source to use.
MLResultMLMediaPlayerAddTimedTextSourceForURI(MLHandle media_player, const char uri, const char mime_type)
Adds a TimedText source from a URI.
MLResultMLMediaPlayerAddTimedTextSourceForFD(MLHandle media_player, int32_t fd, int64_t offset, int64_t length, const char * mime_type)
Adds a TimedText source from a file descriptor.
MLResultMLMediaPlayerSetNextPlayer(MLHandle media_player, MLHandle next_media_player)
Sets the 'next' Media Player to automatically 'start' when current Media Player playback completes.
MLResultMLMediaPlayerGetTrackCount(MLHandle media_player, uint32_t * out_track_count)
Counts the number of tracks found in the data source.
MLResultMLMediaPlayerGetTrackType(MLHandle media_player, uint32_t track, MLMediaPlayerTrackType * out_track_type)
Gets the type of a track.
MLResultMLMediaPlayerGetTrackLanguage(MLHandle media_player, uint32_t track, char ** out_track_language)
Gets the language of a track.
MLResultMLMediaPlayerGetTrackMediaFormat(MLHandle media_player, uint32_t track, MLHandle * out_media_format)
Gets the Media Format of a track.
MLResultMLMediaPlayerSelectTrack(MLHandle media_player, uint32_t track)
Selects a track.
MLResultMLMediaPlayerUnselectTrack(MLHandle media_player, uint32_t track)
Unselects a track.
MLResultMLMediaPlayerPrepare(MLHandle media_player)
Prepares the player for playback, synchronously.
MLResultMLMediaPlayerPrepareAsync(MLHandle media_player)
Prepares the player for playback, asynchronously.
MLResultMLMediaPlayerStart(MLHandle media_player)
Starts or resumes playback.
MLResultMLMediaPlayerStop(MLHandle media_player)
Stops playback after playback has been started or paused.
MLResultMLMediaPlayerPause(MLHandle media_player)
Pauses playback.
MLResultMLMediaPlayerReset(MLHandle media_player)
Resets the Media Player to its uninitialized state.
MLResultMLMediaPlayerSeekTo(MLHandle media_player, int msec, MLMediaSeekMode mode)
Seeks to specified time position.
MLResultMLMediaPlayerSetEventCallbacksEx(MLHandle media_player, const MLMediaPlayerEventCallbacksEx callbacks, void data)
Sets callbacks to notify clients about player events.
MLResultMLMediaPlayerGetVideoSize(MLHandle media_player, int32_t out_width, int32_t out_height)
Returns the size of the video frame.
MLResultMLMediaPlayerGetCurrentPosition(MLHandle media_player, int32_t * out_msec)
Returns current position of playback.
MLResultMLMediaPlayerGetDuration(MLHandle media_player, int32_t * out_msec)
Returns media duration.
MLResultMLMediaPlayerGetBufferingUpdate(MLHandle media_player, int32_t * out_percentage)
Returns current buffering percentage.
MLResultMLMediaPlayerGetInfo(MLHandle media_player, int32_t out_code, int32_t out_extra)
Returns last info received by internal Media Player.
MLResultMLMediaPlayerGetError(MLHandle media_player, MLResult * out_result)
Returns last error received by internal Media Player.
MLResultMLMediaPlayerGetTimedText(MLHandle media_player, const char * out_text, int32_t out_start, int32_t * out_end)
Returns last timed text event information.
MLResultMLMediaPlayerGetSubtitleEx(MLHandle media_player, MLMediaPlayerSubtitleData ** out_subtitle_data)
Returns last subtitle event information.
MLResultMLMediaPlayerReleaseSubtitleEx(MLHandle media_player)
Releases last subtitle event information.
MLResultMLMediaPlayerSetOnMediaSubtitleUpdateCallback(MLHandle media_player, MLMediaPlayerOnMediaSubtitleUpdateCallback on_media_subtitle_callback, void * data)
Sets callback to get notified when a subtitle update is available along with its data.
MLResultMLMediaPlayerGetMetadata(MLHandle media_player, int64_t out_time, int32_t out_size, uint8_t ** out_buffer)
Returns last metadata event information.
MLResultMLMediaPlayerSetVideoScalingMode(MLHandle media_player, MLMediaPlayerVideoScalingMode mode)
Sets video scaling mode.
MLResultMLMediaPlayerSetLooping(MLHandle media_player, bool loop)
Sets the looping mode of the player.
MLResultMLMediaPlayerSetVolume(MLHandle media_player, float volume)
Sets the volume on this player.
MLResultMLMediaPlayerGetAudioHandle(MLHandle media_player, MLHandle * out_handle)
Gets the handle of the audio stream.
MLResultMLMediaPlayerPollStates(MLHandle media_player, uint16_t mask, uint16_t * out_polled_states)
Polls the desired states from internal Media Player.
MLResultMLMediaPlayerGetTrackDRMInfo(MLHandle media_player, const MLMediaPlayerTrackInfo * track_info, MLMediaPlayerTrackDRMInfo ** out_drm_info)
Gets the DRM info of the selected media (either audio or video) track.
MLResultMLMediaPlayerPrepareTrackDRM(MLHandle media_player, const MLMediaPlayerTrackDRMSessionInfo * drm_session_info)
Prepares DRM for the selected media (either audio or video) track.
MLResultMLMediaPlayerReleaseDRM(MLHandle media_player)
Releases DRM.
MLResultMLMediaPlayerGetDefaultBufferingSettings(MLHandle media_player, MLMediaPlayerBufferingSettings * out_buf_settings)
Gets default Buffering settings.
MLResultMLMediaPlayerGetBufferingSettings(MLHandle media_player, MLMediaPlayerBufferingSettings * out_buf_settings)
Gets current Buffering settings.
MLResultMLMediaPlayerSetBufferingSettings(MLHandle media_player, MLMediaPlayerBufferingSettings buf_settings)
Sets buffering settings.
MLResultMLMediaPlayerSetOnMediaTimedTextUpdateCallback(MLHandle media_player, MLMediaPlayerOnMediaTimedTextUpdateCallback on_media_timed_text_callback, void * data)
Set callback to get invoked when a Timed Text update is available along with its data.
MLResultMLMediaPlayerGetWebVTTData(MLHandle media_player, MLHandle timed_text, MLWebVTTData ** out_webvtt_data)
Gets WebVTT data represented by a timed text handle.
MLResultMLMediaPlayerGetTTMLData(MLHandle media_player, MLHandle timed_text, MLTTMLData ** out_ttml_data)
Gets TTML data represented by a timed text handle.
MLResultMLMediaPlayerResetAsync(MLHandle media_player)
Resets the Media Player to its uninitialized state asynchronously.
MLResultMLMediaPlayerGetMetrics(MLHandle media_player, MLMediaPlayerMetrics * out_metrics)
Retrieves metrics recorded on the MediaPlayer.
MLResultMLMediaPlayerSetSurface(MLHandle media_player, MLHandle surface)
Sets the Native surface to be used as the sink for displaying the video portion of the media.

Enums Documentation

MLMediaPlayerVideoScalingMode

EnumeratorValueDescription
MLMediaPlayerVideoScalingMode_ScaleToFit1
MLMediaPlayerVideoScalingMode_ScaleToFitWithCropping2
MLMediaPlayerVideoScalingMode_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Codes for setting video scaling mode.


MLMediaPlayerPollingStateFlags

EnumeratorValueDescription
MLMediaPlayerPollingStateFlag_IsPlaying1 << 0Playing.
MLMediaPlayerPollingStateFlag_IsLooping1 << 1Looping.
MLMediaPlayerPollingStateFlag_HasBeenPrepared1 << 2Prepared.
MLMediaPlayerPollingStateFlag_HasPlaybackCompleted1 << 3Playback completed.
MLMediaPlayerPollingStateFlag_HasSeekCompleted1 << 4Seek completed.
MLMediaPlayerPollingStateFlag_HasSizeChanged1 << 5Size changed.
MLMediaPlayerPollingStateFlag_HasBufferingUpdated1 << 6Buffering updated.
MLMediaPlayerPollingStateFlag_HasReceivedInfo1 << 7Received info.
MLMediaPlayerPollingStateFlag_HasReceivedError1 << 8Received error.
MLMediaPlayerPollingStateFlag_HasTimedTextUpdated1 << 9Timed text updated.
MLMediaPlayerPollingStateFlag_HasSubtitleUpdated1 << 10Subtitle updated.
MLMediaPlayerPollingStateFlag_HasMetadataUpdated1 << 11Metadata updated.
MLMediaPlayerPollingStateFlag_HasDrmInfoUpdated1 << 12DRM info updated.
MLMediaPlayerPollingStateFlag_HasResetCompleted1 << 13Async Reset completed.
MLMediaPlayerPollingStateFlag_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

The state to be polled.


MLMediaPlayerInfo

EnumeratorValueDescription
MLMediaPlayerInfo_Unknown1Unknown.
MLMediaPlayerInfo_StartedAsNext2The player was started because it was used as the next player.
MLMediaPlayerInfo_RenderingStart3The player just pushed the very first video frame for rendering.
MLMediaPlayerInfo_Looping4The player just reached EOS and started from beginning (loop).
MLMediaPlayerInfo_Started5The player acknowledgement that it has started playing.
MLMediaPlayerInfo_Paused6The player acknowledgement that it has paused.
MLMediaPlayerInfo_Stopped7The player acknowledgement that it has stopped playing.
MLMediaPlayerInfo_StartedBySharedPlayer8The player acknowledgement that it has started playing as result of shared player's request.
MLMediaPlayerInfo_PausedBySharedPlayer9The player acknowledgement that it has paused playing as result of shared player's request.
MLMediaPlayerInfo_SeekBySharedPlayer10The player acknowledgement that it is seeking as result of shared player's request.
MLMediaPlayerInfo_StoppedBySharedPlayer11The player acknowledgement that it has stopped playing as result of shared player's request.
MLMediaPlayerInfo_SyncStart12The player has started sync'ing with other shared players.
MLMediaPlayerInfo_SyncComplete13The player has completed sync'ing with other shared players.
MLMediaPlayerInfo_VideoTrackLagging700The video is too complex for the decoder, it can't decode frames fast enough.
MLMediaPlayerInfo_BufferingStart701Media player is temporarily pausing playback.
MLMediaPlayerInfo_BufferingEnd702Media player is resuming playback after filling buffers.
MLMediaPlayerInfo_NetworkBandwidth703Network bandwidth info.
MLMediaPlayerInfo_BehindLiveWindow704Dash Live stream is Behind Live Window.
MLMediaPlayerInfo_PowerStatePause705Playback Paused because of Power State Transition.
MLMediaPlayerInfo_PowerStateResume706Playback Resumed because of Power State Transition.
MLMediaPlayerInfo_BufferedDuration707Duration in milliseconds of buffered content.
MLMediaPlayerInfo_BadInterleaving800Bad interleaving means that a media has been improperly interleaved.
MLMediaPlayerInfo_NotSeekable801The media is not seekable (e.g live stream).
MLMediaPlayerInfo_MetadataUpdate802New media metadata is available.
MLMediaPlayerInfo_PlayAudioError804Audio can not be played.
MLMediaPlayerInfo_PlayVideoError805Video can not be played.
MLMediaPlayerInfo_TimedTextError900Media timed text error.
MLMediaPlayerInfo_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Info and warning codes for the media player framework.

These are non fatal, the playback is going on but there might be some user visible issues.

Info and warning messages are communicated back to the client using the on_info callback. In this situation, this method is invoked with the following:

Description of 'what' should be a value from the MLMediaPlayerInfo. Description of 'extra' contains an implementation dependent info code to provide more details. Should default to 0 when not used.


MLMediaPlayerTrackType

EnumeratorValueDescription
MLMediaPlayerTrackType_Unknown0Unknown.
MLMediaPlayerTrackType_Video1Video.
MLMediaPlayerTrackType_Audio2Audio.
MLMediaPlayerTrackType_TimedText3Timed text.
MLMediaPlayerTrackType_Subtitle4Subtitle.
MLMediaPlayerTrackType_Metadata5Metadata.
MLMediaPlayerTrackType_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

MediaTrack types returned by MLMediaPlayerGetTrackType().


MLMediaPlayerBufferingMode

EnumeratorValueDescription
MLMediaPlayerBufferingMode_None0Do not support buffering.
MLMediaPlayerBufferingMode_TimeOnly1Support only time based buffering.
MLMediaPlayerBufferingMode_SizeOnly2Support only size based buffering.
MLMediaPlayerBufferingMode_TimeThenSize3Support both time and size based buffering, time based calculation precedes size based. Size based calculation will be used only when time information is not available for the stream.
MLMediaPlayerBufferingMode_Count4Number of modes.
MLMediaPlayerBufferingMode_Ensure32Bits0x7FFFFFFFEnsure enum size is 32 bits.

Indicate the mode of buffering settings.


MLMediaFramePackingMode

EnumeratorValueDescription
MLMediaFramePackingMode_None0Not a stereoscopic video.
MLMediaFramePackingMode_CheckboardCheckboard.
MLMediaFramePackingMode_ColumnInterleavedColumn interleaved.
MLMediaFramePackingMode_RowInterleavedRow interleaved.
MLMediaFramePackingMode_SideBySideQuincunxSide by side quincunx.
MLMediaFramePackingMode_SideBySideSide by side.
MLMediaFramePackingMode_TopBottomTop bottom.
MLMediaFramePackingMode_MultiviewFrameByFrameMultiview frame by frame.
MLMediaFramePackingMode_FrameByFrameFrame by frame.
MLMediaFramePackingMode_AnaglyphAnaglyph.

Frame Packing Arrangement for stereoscopic videos.

API Level:

  • 8

MLMediaFramePackingFlags

EnumeratorValueDescription
MLMediaFramePackingFlags_None0No flags.
MLMediaFramePackingFlags_RightViewFirst1 << 0Right view first.
MLMediaFramePackingFlags_LeftFlipped1 << 1Left view flipped.
MLMediaFramePackingFlags_RightFlipped1 << 2Right view flipped.
MLMediaFramePackingFlags_Anaglyph_RedCyan1 << 3Anaglyph red/cyan.
MLMediaFramePackingFlags_Anaglyph_GreenMagenta1 << 4Anaglyph green/magenta.

Frame Packing Arrangement flags for stereoscopic videos.

API Level:

  • 8

Types Documentation

MLMediaPlayerPSSHEntry

typedef MLPSSHEntry MLMediaPlayerPSSHEntry;

More Info


MLMediaPlayerTrackDRMInfo

typedef struct MLMediaPlayerTrackDRMInfo MLMediaPlayerTrackDRMInfo;

MediaPlayer DRM Info for a Media Track .

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerSubtitleData

typedef struct MLMediaPlayerSubtitleData MLMediaPlayerSubtitleData;

MediaPlayer subtitle data.

More Info


MLMediaPlayerBufferingSettings

typedef struct MLMediaPlayerBufferingSettings MLMediaPlayerBufferingSettings;

Indicate the buffering settings.

More Info


MLMediaPlayerOnBufferingUpdateInfo

typedef struct MLMediaPlayerOnBufferingUpdateInfo MLMediaPlayerOnBufferingUpdateInfo;

MediaPlayer Buffering update callback Info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerOnCompletionInfo

typedef struct MLMediaPlayerOnCompletionInfo MLMediaPlayerOnCompletionInfo;

MediaPlayer Playback completion callback Info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerOnErrorInfo

typedef struct MLMediaPlayerOnErrorInfo MLMediaPlayerOnErrorInfo;

MediaPlayer Error callback Info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerOnInfoInfo

typedef struct MLMediaPlayerOnInfoInfo MLMediaPlayerOnInfoInfo;

MediaPlayer Information callback Info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerOnPreparedInfo

typedef struct MLMediaPlayerOnPreparedInfo MLMediaPlayerOnPreparedInfo;

MediaPlayer Playback prepared callback Info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerOnSeekCompleteInfo

typedef struct MLMediaPlayerOnSeekCompleteInfo MLMediaPlayerOnSeekCompleteInfo;

MediaPlayer Playback seek completion callback Info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerOnVideoSizeChangedInfo

typedef struct MLMediaPlayerOnVideoSizeChangedInfo MLMediaPlayerOnVideoSizeChangedInfo;

MediaPlayer Video Size Changed callback Info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerOnTrackDRMInfo

typedef struct MLMediaPlayerOnTrackDRMInfo MLMediaPlayerOnTrackDRMInfo;

MediaPlayer Track DRM Info callback Info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerOnResetCompleteInfo

typedef struct MLMediaPlayerOnResetCompleteInfo MLMediaPlayerOnResetCompleteInfo;

MediaPlayer reset completion callback Info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLMediaPlayerOnFramePackingInfo

typedef struct MLMediaPlayerOnFramePackingInfo MLMediaPlayerOnFramePackingInfo;

MediaPlayer frame packing callback Info.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLMediaPlayerEventCallbacksEx

typedef struct MLMediaPlayerEventCallbacksEx MLMediaPlayerEventCallbacksEx;

Callbacks for notifying client about Media Player error events.

Those are async mechanisms that should not be used in parallel with their sync counterpart, i.e. poll-based queries for the same events using MLMediaPlayerPollStatespoll().

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLMediaPlayerTrackInfo

typedef struct MLMediaPlayerTrackInfo MLMediaPlayerTrackInfo;

MediaPlayer Track Information.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerTrackDRMSessionInfo

typedef struct MLMediaPlayerTrackDRMSessionInfo MLMediaPlayerTrackDRMSessionInfo;

DRM Session information for a MediaPlayer Track.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerOnMediaSubtitleUpdateCallback

typedef void(* MLMediaPlayerOnMediaSubtitleUpdateCallback) (MLHandle media_player, MLMediaPlayerSubtitleData subtitle_data, void *data);

Callbacks signature called when subtitle update is available.

Parameters

dataCustom data to be returned when callback is fired.
media_playerMLHandle is a Media Player instance for which callback was called.
subtitle_dataMLMediaPlayerSubtitleData is the raw subtitle data.

MLMediaPlayerOnMediaTimedTextUpdateCallback

typedef void(* MLMediaPlayerOnMediaTimedTextUpdateCallback) (MLHandle media_player, MLHandle timed_text, void *data);

Callbacks signature called when Timed Text update is available.

Parameters

media_playerMLHandle is a Media Player instance for which callback was called.
timed_textMLHandle is the handle for timed_text data.
dataCustom data to be delivered when callback is invoked.

Required Permissions:

  • None

API Level:

  • 4

MLMediaPlayerMetrics

typedef struct MLMediaPlayerMetrics MLMediaPlayerMetrics;

MediaPlayer metrics data.

More Info

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

Functions Documentation

MLMediaPlayerEventCallbacksExInit

static inline void MLMediaPlayerEventCallbacksExInit(
MLMediaPlayerEventCallbacksEx * inout_callbacks
)

Initializes MediaPlayerEventCallbacks with default values.

Parameters

MLMediaPlayerEventCallbacksEx *inout_callbacksMedia Player Callback structure defined by MLMediaPlayerEventCallbacksEx that needs to be initialized.

MLMediaPlayerTrackInfoInit

static inline void MLMediaPlayerTrackInfoInit(
MLMediaPlayerTrackInfo * inout_track_info
)

Initializes Media Track Information with default values.

Parameters

MLMediaPlayerTrackInfo *inout_track_infoMedia track information defined by MLMediaPlayerTrackInfo that needs to be initialized.

MLMediaPlayerTrackDRMSessionInfoInit

static inline void MLMediaPlayerTrackDRMSessionInfoInit(
MLMediaPlayerTrackDRMSessionInfo * inout_drm_session_info
)

Initializes Media Track DRM Session Information with defult values.

Parameters

MLMediaPlayerTrackDRMSessionInfo *inout_drm_session_infoMedia track DRM Session information defined by MLMediaPlayerTrackDRMSessionInfo that needs to be initialized.

MLMediaPlayerCreate

MLResult MLMediaPlayerCreate(
MLHandle * out_handle
)

Create a new Media Player object.

Parameters

MLHandle *out_handleThe MLHandle to the new Media Player object created. Only valid if result is MLResult_Ok.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully created MediaPlayer.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

note

This is a blocking sync method. As creating a MediaPlayer object might take some time, make sure to not call this API from your main UI thread.


MLMediaPlayerDestroy

MLResult MLMediaPlayerDestroy(
MLHandle media_player
)

Destroys a MediaPlayer object.

Parameters

MLHandlemedia_playerMLHandle to the Media Player object to destroy.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully destroyed MediaPlayer.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

note

This is a blocking sync method. As destroying a MediaPlayer object might take some time, make sure to not call this API from your main UI thread.


MLMediaPlayerSetDataSourceForFD

MLResult MLMediaPlayerSetDataSourceForFD(
MLHandle media_player,
int32_t fd
)

Sets a file descriptor as the data source.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
int32_tfdThe file descriptor for the file you want to play.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set file descriptor.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

The file descriptor must be seekable. It is the caller's responsibility to close the file descriptor. It is safe to do so as soon as this call returns.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetOffsetDataSourceForFD

MLResult MLMediaPlayerSetOffsetDataSourceForFD(
MLHandle media_player,
int32_t fd,
int64_t offset,
int64_t length
)

Sets a file descriptor as the data source with offset.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
int32_tfdThe file descriptor for the file you want to play.
int64_toffsetThe offset (in bytes) of the source's start.
int64_tlengthThe number of bytes of media to load after offset.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set file descriptor.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

The file descriptor must be seekable. It is the caller's responsibility to close the file descriptor. It is safe to do so as soon as this call returns. This API is useful for specifying playable media located in resource files.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetDataSourceForPath

MLResult MLMediaPlayerSetDataSourceForPath(
MLHandle media_player,
const char * path
)

Sets a local file path as the data source.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
const char *pathThe linux-style path of the file.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set local file path.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

The path should be an absolute path and should reference a world-readable file.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetDataSourceForURI

MLResult MLMediaPlayerSetDataSourceForURI(
MLHandle media_player,
const char * uri
)

Sets a URI string as the data source.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
const char *uriThe C-style string representing the URI complete string.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set URI string.
MLResultMLResult_PermissionDeniedFailed due to lack of permission.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • android.permission.INTERNET (protection level: normal)

Supported URI schemes are file, http, https, and rtsp. If looking to provide headers, use MLMediaPlayerSetRemoteDataSourceForURI().

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetRemoteDataSourceForURI

MLResult MLMediaPlayerSetRemoteDataSourceForURI(
MLHandle media_player,
const char * uri,
char ** headers,
size_t len
)

Sets a URI string as the remote data source.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
const char *uriThe C-style string representing the complete URL.
char **headersArray of char * headers to be sent.
size_tlenNumber of headers passed.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set URI string.
MLResultMLResult_PermissionDeniedFailed due to lack of permission.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • android.permission.INTERNET (protection level: normal)

Supported URI schemes are file, http, https, and rtsp.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetMediaDataSource

MLResult MLMediaPlayerSetMediaDataSource(
MLHandle media_player,
MLHandle media_data_source
)

Sets the data source to use.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLHandlemedia_data_sourceMLHandle returned by MLMediaDataSourceCreate().

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set the data source to use.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NameNotFoundFailed because no valid source could be found.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetMediaStreamSource

MLResult MLMediaPlayerSetMediaStreamSource(
MLHandle media_player,
MLHandle media_stream_source
)

Sets the data source to use.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLHandlemedia_stream_sourceMLHandle returned by MLMediaStreamSourceCreate().

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set the data source to use.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NameNotFoundFailed because no valid source could be found.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerAddTimedTextSourceForURI

MLResult MLMediaPlayerAddTimedTextSourceForURI(
MLHandle media_player,
const char * uri,
const char * mime_type
)

Adds a TimedText source from a URI.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
const char *uriThe C-style string representing the complete URI.
const char *mime_typeThe MIME type of the file.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully added TimedText source from URI.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown failure.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerAddTimedTextSourceForFD

MLResult MLMediaPlayerAddTimedTextSourceForFD(
MLHandle media_player,
int32_t fd,
int64_t offset,
int64_t length,
const char * mime_type
)

Adds a TimedText source from a file descriptor.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
int32_tfdThe file descriptor for the timed text source.
int64_toffsetThe offset (in bytes) of the source's start. Must be >= 0.
int64_tlengthThe number of bytes of media to load after offset. Must be >= 0.
const char *mime_typeThe MIME type of the file.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully added TimedText source from file descriptor.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown failure.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

The file descriptor must be seekable. It is the caller's responsibility to close the file descriptor. It is safe to do so as soon as this call returns.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetNextPlayer

MLResult MLMediaPlayerSetNextPlayer(
MLHandle media_player,
MLHandle next_media_player
)

Sets the 'next' Media Player to automatically 'start' when current Media Player playback completes.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLHandlenext_media_playerMLHandle of an already created Media Player instance. To 'remove' the next player, set next_media_player = 0.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully registered next Media Player.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NameNotFoundFailed source because no valid source could be found.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetTrackCount

MLResult MLMediaPlayerGetTrackCount(
MLHandle media_player,
uint32_t * out_track_count
)

Counts the number of tracks found in the data source.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
uint32_t *out_track_countThe number of tracks found in the player source.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned the number of tracks.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetTrackType

MLResult MLMediaPlayerGetTrackType(
MLHandle media_player,
uint32_t track,
MLMediaPlayerTrackType * out_track_type
)

Gets the type of a track.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
uint32_ttrackThe track number for which type is to be returned. Has to be < TrackCount.
MLMediaPlayerTrackType *out_track_typeThe returned type for specified track number.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned type for passed track.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NameNotFoundFound track's type was unknown.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetTrackLanguage

MLResult MLMediaPlayerGetTrackLanguage(
MLHandle media_player,
uint32_t track,
char ** out_track_language
)

Gets the language of a track.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
uint32_ttrackThe track number for which language is to be returned. Has to be < TrackCount.
char **out_track_languageThe returned language of the track. Caller has ownership of that param and has to free it when no longer needed.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned language for passed track.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetTrackMediaFormat

MLResult MLMediaPlayerGetTrackMediaFormat(
MLHandle media_player,
uint32_t track,
MLHandle * out_media_format
)

Gets the Media Format of a track.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
uint32_ttrackThe track number for which Media Format is to be returned. Has to be < TrackCount.
MLHandle *out_media_formatMLHandle to MediaFormat of the track. Caller has ownership of this handle and should call MLMediaFormatDestroy to free it when no longer needed.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully retreived the media format of passed track.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerSelectTrack

MLResult MLMediaPlayerSelectTrack(
MLHandle media_player,
uint32_t track
)

Selects a track.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
uint32_ttrackNumber of the track to select. Has to be < TrackCount.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully selected track.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerUnselectTrack

MLResult MLMediaPlayerUnselectTrack(
MLHandle media_player,
uint32_t track
)

Unselects a track.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
uint32_ttrackNumber of the track to unselect. Has to be < TrackCount.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully unselected track.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerPrepare

MLResult MLMediaPlayerPrepare(
MLHandle media_player
)

Prepares the player for playback, synchronously.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully prepared the player.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. Can only be called after one of the setDataSource methods or in the 'stopped' state.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.
MLResultMLMediaResult_CannotConnectFailed becaue MediaPlayer could not connect with the given URL.

Required Permissions:

  • None

After setting the data source and the #GraphicBufferProducer, you need to either call prepare() or prepareAsync(). For files, it is OK to call prepare(), which blocks until Media Player is ready for playback.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerPrepareAsync

MLResult MLMediaPlayerPrepareAsync(
MLHandle media_player
)

Prepares the player for playback, asynchronously.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully prepared the player asynchronously. For result, poll for MLMediaPlayerPollingStateFlag_HasBeenPrepared state or wait for 'on_prepared' callback if already set.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. Can only be called after one of the setDataSource methods or in the 'stopped' state.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

After setting the data's source and the #GraphicBufferProducer, you need to either call prepare() or prepareAsync(). For streams, you should call prepareAsync(), which returns immediately, rather than blocking until enough data has been buffered. Prepared state will then be obtained via the 'on_prepared' callback if already registered (see MLMediaPlayerSetEventCallbacksEx), or polled for via the MLMediaPlayerPollStates() call with the MLMediaPlayerPollingStateFlag_HasBeenPrepared flag set.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerStart

MLResult MLMediaPlayerStart(
MLHandle media_player
)

Starts or resumes playback.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully started/resumed playback.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. Can only be called in one of the following states: 'prepared', 'playback complete', 'paused', 'stopped'.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

If playback had previously been paused, playback will continue from where it was paused. If playback had been stopped, or never started before, playback will start at the beginning.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerStop

MLResult MLMediaPlayerStop(
MLHandle media_player
)

Stops playback after playback has been started or paused.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully stopped playback.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. Can only be called in one of the following states: 'playing', 'paused', 'stopped', 'prepared', 'playback complete'.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerPause

MLResult MLMediaPlayerPause(
MLHandle media_player
)

Pauses playback.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully paused playback.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. Can only be called in one of the following states: 'playing', 'paused', 'playback complete'.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

Calling pause() is a NOOP if Media Player is in state #MEDIA_PLAYER_PAUSED or #MEDIA_PLAYER_PLAYBACK_COMPLETE.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerReset

MLResult MLMediaPlayerReset(
MLHandle media_player
)

Resets the Media Player to its uninitialized state.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully reset MediaPlayer.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. This method can be called anytime except when in 'preparing async'.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

After calling this method, you will have to initialize it again by setting the data source and calling prepare().

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

note

This is a blocking sync method, make sure to not call this API from your main UI thread.


MLMediaPlayerSeekTo

MLResult MLMediaPlayerSeekTo(
MLHandle media_player,
int msec,
MLMediaSeekMode mode
)

Seeks to specified time position.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
intmsecThe offset in milliseconds from the start, to seek to.
MLMediaSeekModemodeSeek mode defined by MLMediaSeekMode.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully launched seek operation asynchronously. For result, poll for MLMediaPlayerPollingStateFlag_HasSeekCompleted state or wait for the 'on_seek_complete' callback if already set.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. This method can only be called from the following states: 'started', 'prepared', 'paused' and 'playback complete'.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

Note that SeekTo is an async. function and returns immediately. Successful seek result has to be obtained either via the 'on_seek_complete' if already registered (see MLMediaPlayerSetEventCallbacksEx) or by polling for the flag 'MLMediaPlayerPollingStateFlag_HasSeekCompleted' when calling MLMediaPlayerPollStates().

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetEventCallbacksEx

MLResult MLMediaPlayerSetEventCallbacksEx(
MLHandle media_player,
const MLMediaPlayerEventCallbacksEx * callbacks,
void * data
)

Sets callbacks to notify clients about player events.

Parameters

MLHandlemedia_playerMLHandle to the MediaCodec.
const MLMediaPlayerEventCallbacksEx *callbacksSet of event callbacks. Can be set to NULL to unset the callbacks altogether.
void *dataCustom data to be returned when any callback is fired.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set/unset the specified callbacks.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.

Required Permissions:

  • None

This structure must be initialized by calling MLMediaPlayerEventCallbacksExInit() before use.

Client needs to implement the callback functions declared in MLMediaPlayerEventCallbacksEx, but can set to NULL the ones he does not care about.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerGetVideoSize

MLResult MLMediaPlayerGetVideoSize(
MLHandle media_player,
int32_t * out_width,
int32_t * out_height
)

Returns the size of the video frame.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
int32_t *out_widthThe returned video width.
int32_t *out_heightThe returned video height.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned video size.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetCurrentPosition

MLResult MLMediaPlayerGetCurrentPosition(
MLHandle media_player,
int32_t * out_msec
)

Returns current position of playback.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
int32_t *out_msecThe returned position in milliseconds.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned current position.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetDuration

MLResult MLMediaPlayerGetDuration(
MLHandle media_player,
int32_t * out_msec
)

Returns media duration.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
int32_t *out_msecThe returned duration in milliseconds.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned the media duration.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. This method can only be called from the following states: 'prepared', 'started', 'paused', 'stopped' and 'playback complete'.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetBufferingUpdate

MLResult MLMediaPlayerGetBufferingUpdate(
MLHandle media_player,
int32_t * out_percentage
)

Returns current buffering percentage.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
int32_t *out_percentageThe returned buffering percentage in the range [0, 100].

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned current buffering percentage.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetInfo

MLResult MLMediaPlayerGetInfo(
MLHandle media_player,
int32_t * out_code,
int32_t * out_extra
)

Returns last info received by internal Media Player.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
int32_t *out_codeThe main info code.
int32_t *out_extraThe secondary code/data.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned the last MediaPlayer.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetError

MLResult MLMediaPlayerGetError(
MLHandle media_player,
MLResult * out_result
)

Returns last error received by internal Media Player.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLResult *out_resultThe result code.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned the last MediaPlayer error.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetTimedText

MLResult MLMediaPlayerGetTimedText(
MLHandle media_player,
const char ** out_text,
int32_t * out_start,
int32_t * out_end
)

Returns last timed text event information.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
const char **out_textThe text of the timed text event.
int32_t *out_startThe start time.
int32_t *out_endThe end time.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned the last timedtext entry.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetSubtitleEx

MLResult MLMediaPlayerGetSubtitleEx(
MLHandle media_player,
MLMediaPlayerSubtitleData ** out_subtitle_data
)

Returns last subtitle event information.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLMediaPlayerSubtitleData **out_subtitle_dataThe returned MLMediaPlayerGetSubtitleExArgs pointer.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned the last subtitle entry.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerReleaseSubtitleEx

MLResult MLMediaPlayerReleaseSubtitleEx(
MLHandle media_player
)

Releases last subtitle event information.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully released the last subtitle entry.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerSetOnMediaSubtitleUpdateCallback

MLResult MLMediaPlayerSetOnMediaSubtitleUpdateCallback(
MLHandle media_player,
MLMediaPlayerOnMediaSubtitleUpdateCallback on_media_subtitle_callback,
void * data
)

Sets callback to get notified when a subtitle update is available along with its data.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLMediaPlayerOnMediaSubtitleUpdateCallbackon_media_subtitle_callbackFunction pointer to be called. This can be 'NULL' to unset the callback. See MLMediaPlayerOnMediaSubtitleUpdateCallback() callback typedef declaration and comments for explanation on expected callback parameters.
void *dataCustom data to be returned when callback is fired.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set callback.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.

Required Permissions:

  • None

Setting this callback disables use of the poll-based API to query for the MLMediaPlayerPollingStateFlag_HasSubtitleUpdated flag. MLMediaPlayerPollStates() will ignore checks for this bit.

This also makes MLMediaPlayerGetSubtitleEx() redundant as the subtitle data is provided with the callback.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 4

MLMediaPlayerGetMetadata

MLResult MLMediaPlayerGetMetadata(
MLHandle media_player,
int64_t * out_time,
int32_t * out_size,
uint8_t ** out_buffer
)

Returns last metadata event information.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
int64_t *out_timeThe returned event time.
int32_t *out_sizeThe returned event buffer size.
uint8_t **out_bufferThe returned event buffer. This buffer is only valid until the next metadata event arrives, so make a copy if you need to use the buffer later.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned last metadata entry.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetVideoScalingMode

MLResult MLMediaPlayerSetVideoScalingMode(
MLHandle media_player,
MLMediaPlayerVideoScalingMode mode
)

Sets video scaling mode.

Parameters

MLHandlemedia_playerMLHandle to the MediaPlayer instance.
MLMediaPlayerVideoScalingModemodeThe video scaling mode to set. For a list of valid values, see #media_video_scaling_mode_type declaration.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned current video scaling mode.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetLooping

MLResult MLMediaPlayerSetLooping(
MLHandle media_player,
bool loop
)

Sets the looping mode of the player.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
boolloopThe looping mode. Set to true if player should loop to beginning of MediaPlayer when EOS reached. Set to false if MediaPlayer should simply stop playback at end of media.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned current looping mode.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetVolume

MLResult MLMediaPlayerSetVolume(
MLHandle media_player,
float volume
)

Sets the volume on this player.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
floatvolumeThe new volume in the [0.0, 1.0] range.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set the volume.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetAudioHandle

MLResult MLMediaPlayerGetAudioHandle(
MLHandle media_player,
MLHandle * out_handle
)

Gets the handle of the audio stream.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLHandle *out_handleThe MLHandle to the returned Audio handle. Only valid if result is MLResult_Ok.

Returns

MLResultMLResult_NotImplementedIf used in versions starting 1.2.0 or later.

Required Permissions:

  • None
Deprecated

Unsupported since 1.2.0. Scheduled for removal.


MLMediaPlayerPollStates

MLResult MLMediaPlayerPollStates(
MLHandle media_player,
uint16_t mask,
uint16_t * out_polled_states
)

Polls the desired states from internal Media Player.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
uint16_tmaskSelection mask for picking which states to retrieve.
uint16_t *out_polled_statesBitwise OR'ed integer of all the chosen states from bitwise 'mask' and in the range [0 = false : 1 = true].

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully polled and returned the selected states.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.

Required Permissions:

  • None

Desired states have to be selected by passing a bitwise OR'ed mask of MLMediaPlayerPollingStateFlags flags.

The "is_XXX" states can be polled multiples times and the return value will be the same if internal state hasn't changed since last call.

When polling the "has_XXX" states however, internal state is set to false, since they mean : has <state> happened/changed since I last polled <state>.

Two-step state polling : The following states, when returning '1', indicate there is some data ready to be retrieved, by calling a getter function, as explained below.

For '#MLMediaPlayerPollingState_HasSizeChanged', call MLMediaPlayerGetVideoSize() to get the new size.

For '#MLMediaPlayerPollingState_HasBufferingUpdated', call MLMediaPlayerGetBufferingUpdate() to get buffering progress value.

For '#MLMediaPlayerPollingState_HasReceivedInfo, call MLMediaPlayerGetError() to get last info code and data.

For '#MLMediaPlayerPollingState_HasReceivedError, call MLMediaPlayerGetError() to get last error code and data.

Note: This API can still be used even if an #OnBufferAvailable callback has been set using MLMediaPlayerSetOnBufferAvailableCallback() method.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetTrackDRMInfo

MLResult MLMediaPlayerGetTrackDRMInfo(
MLHandle media_player,
const MLMediaPlayerTrackInfo * track_info,
MLMediaPlayerTrackDRMInfo ** out_drm_info
)

Gets the DRM info of the selected media (either audio or video) track.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
const MLMediaPlayerTrackInfo *track_infoMedia track information defined by MLMediaPlayerTrackInfo.
MLMediaPlayerTrackDRMInfo **out_drm_infoPointer to the pointer to MLMediaPlayerTrackDRMInfo struct. The caller should not free the pointer returned. The memory will be released in the call to MLMediaPlayerReleaseDRM().

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned the current DRM Info.
MLResultMLResult_PendingMedia Source is not prepared yet. Wait for on_prepared callback and call again.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.
MLResultMLMediaGenericResult_NotAvailableDRM Information not available for the given track.

Required Permissions:

  • None

This function has to be called only after DataSource has been set and the MediaPlayer is completely prepared.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerPrepareTrackDRM

MLResult MLMediaPlayerPrepareTrackDRM(
MLHandle media_player,
const MLMediaPlayerTrackDRMSessionInfo * drm_session_info
)

Prepares DRM for the selected media (either audio or video) track.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
const MLMediaPlayerTrackDRMSessionInfo *drm_session_infoDRM Session info for the Media track, as defined by MLMediaPlayerTrackDRMSessionInfo.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully prepared DRM.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 2

MLMediaPlayerReleaseDRM

MLResult MLMediaPlayerReleaseDRM(
MLHandle media_player
)

Releases DRM.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully released DRM.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetDefaultBufferingSettings

MLResult MLMediaPlayerGetDefaultBufferingSettings(
MLHandle media_player,
MLMediaPlayerBufferingSettings * out_buf_settings
)

Gets default Buffering settings.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLMediaPlayerBufferingSettings *out_buf_settingsA pointer to MLMediaPlayerBufferingSettings.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned default Buffering settings.
MLResultMLResult_NotImplementedFeature not implemented in the given model.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

\Attention The API is only implemented in ML1.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerGetBufferingSettings

MLResult MLMediaPlayerGetBufferingSettings(
MLHandle media_player,
MLMediaPlayerBufferingSettings * out_buf_settings
)

Gets current Buffering settings.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLMediaPlayerBufferingSettings *out_buf_settingsA pointer to MLMediaPlayerBufferingSettings.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned current Buffering settings.
MLResultMLResult_NotImplementedFeature not implemented in the given model.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

\Attention The API is only implemented in ML1.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetBufferingSettings

MLResult MLMediaPlayerSetBufferingSettings(
MLHandle media_player,
MLMediaPlayerBufferingSettings buf_settings
)

Sets buffering settings.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLMediaPlayerBufferingSettingsbuf_settingsAn MLMediaPlayerBufferingSettings struct.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully set buffering settings.
MLResultMLResult_NotImplementedFeature not implemented in the given model.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

\Attention The API is only implemented in ML1.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.


MLMediaPlayerSetOnMediaTimedTextUpdateCallback

MLResult MLMediaPlayerSetOnMediaTimedTextUpdateCallback(
MLHandle media_player,
MLMediaPlayerOnMediaTimedTextUpdateCallback on_media_timed_text_callback,
void * data
)

Set callback to get invoked when a Timed Text update is available along with its data.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLMediaPlayerOnMediaTimedTextUpdateCallbackon_media_timed_text_callbackFunction pointer to be called. This can be 'NULL' to unset the callback.
void *dataCustom data to be returned when callback is fired.

Returns

MLResultMLResult_OkSuccessfully set callback.
MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.

Required Permissions:

  • None

Setting this callback disables use of the poll-based API to query for the MLMediaPlayerPollingStateFlag_HasTimedTextUpdated flag. MLMediaPlayerPollStates() will ignore checks for this bit.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 4

MLMediaPlayerGetWebVTTData

MLResult MLMediaPlayerGetWebVTTData(
MLHandle media_player,
MLHandle timed_text,
MLWebVTTData ** out_webvtt_data
)

Gets WebVTT data represented by a timed text handle.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLHandletimed_textThe Timed Text handle.
MLWebVTTData **out_webvtt_dataThe WebVTT data structure to be returned.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned WebVTT data.
MLResultMLMediaGenericResult_BadTypeFailed because the timed_text handle was not in the WebVTT format. The timed text track's mime type must be "text/vtt".
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

The returned MLWebVTTData structure is valid only in the callback's context.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 4

MLMediaPlayerGetTTMLData

MLResult MLMediaPlayerGetTTMLData(
MLHandle media_player,
MLHandle timed_text,
MLTTMLData ** out_ttml_data
)

Gets TTML data represented by a timed text handle.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLHandletimed_textThe Timed Text handle.
MLTTMLData **out_ttml_dataThe TTML data structure to be returned.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully returned TTML data.
MLResultMLMediaGenericResult_BadTypeFailed because the timed_text handle was not in the TTML format. The timed text track's mime type must be "application/ttml+xml".
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

The returned MLTTMLData structure is valid only in the callback's context.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

MLMediaPlayerResetAsync

MLResult MLMediaPlayerResetAsync(
MLHandle media_player
)

Resets the Media Player to its uninitialized state asynchronously.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully launched MediaPlayer reset operation asynchronously. For result, poll for MLMediaPlayerPollingStateFlag_HasResetCompleted or use the 'on_reset_complete' callback if already set.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state. This method can be called anytime except when in 'preparing async'.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None

This method is asynchronous and will return immediately. After invocation, you will have to initialize it again by setting the data source and calling prepare() or prepareAsync().

A successful reset result can be obtained either by registering the 'on_reset_complete' callback (see MLMediaPlayerSetEventCallbacksEx) or by polling for the 'MLMediaPlayerPollingStateFlag_HasResetCompleted' flag when calling MLMediaPlayerPollStates().

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLMediaPlayerGetMetrics

MLResult MLMediaPlayerGetMetrics(
MLHandle media_player,
MLMediaPlayerMetrics * out_metrics
)

Retrieves metrics recorded on the MediaPlayer.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLMediaPlayerMetrics *out_metricsSee MLMediaPlayerMetrics.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSuccessfully received metrics.
MLResultMLResult_UnspecifiedFailureFailed due to an unknown error.
MLResultMLMediaGenericResult_InvalidOperationFailed because method was called in the wrong state.
MLResultMLMediaGenericResult_NoInitFailed because MediaPlayer was not properly initialized.

Required Permissions:

  • None
Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 8

MLMediaPlayerSetSurface

MLResult MLMediaPlayerSetSurface(
MLHandle media_player,
MLHandle surface
)

Sets the Native surface to be used as the sink for displaying the video portion of the media.

Parameters

MLHandlemedia_playerHandle to the MediaPlayer instance.
MLHandlesurfaceHandle to the MLNativeSurface object.

Returns

MLResultMLResult_InvalidParamPassed media_player or the surface handle was not found.
MLResultMLResult_OkSuccessfully set output surface.
MLResultMLResult_UnspecifiedFailureInternal error.
MLResultMLMediaGenericResult_InvalidOperationMethod was called from the wrong state.
MLResultMLMediaGenericResult_NoInitMediaPlayer was not properly built or initialized.

Required Permissions:

  • None

The surface should be created by MLNativeSurfaceCreate(). When called, this method should be called after one of the MLMediaPlayerSetDataSource() API and before MLMediaPlayerPrepare() or MLMediaPlayerPrepareAsync() Not calling this method or calling this with surface as ML_INVALID_HANDLE will result in only the audio track being played.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

Source code

// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2017 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement,
// located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying
// this distribution may also be found in the top-level NOTICE file
// appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

#pragma once

#include "ml_api.h"
#include "ml_media_common.h"
#include "ml_media_data_source.h"
#include "ml_media_error.h"
#include "ml_media_stream_source.h"
#include "ml_types.h"
#include "ml_media_types.h"
#include "ml_media_drm.h"
#include "ml_media_webvtt.h"
#include "ml_media_ttml.h"
#include <stddef.h>

ML_EXTERN_C_BEGIN

typedef enum MLMediaPlayerVideoScalingMode {
MLMediaPlayerVideoScalingMode_ScaleToFit = 1,
MLMediaPlayerVideoScalingMode_ScaleToFitWithCropping = 2,
MLMediaPlayerVideoScalingMode_Ensure32Bits = 0x7FFFFFFF
} MLMediaPlayerVideoScalingMode;

typedef enum MLMediaPlayerPollingStateFlags {
MLMediaPlayerPollingStateFlag_IsPlaying = 1 << 0,
MLMediaPlayerPollingStateFlag_IsLooping = 1 << 1,
MLMediaPlayerPollingStateFlag_HasBeenPrepared = 1 << 2,
MLMediaPlayerPollingStateFlag_HasPlaybackCompleted = 1 << 3,
MLMediaPlayerPollingStateFlag_HasSeekCompleted = 1 << 4,
MLMediaPlayerPollingStateFlag_HasSizeChanged = 1 << 5,
MLMediaPlayerPollingStateFlag_HasBufferingUpdated = 1 << 6,
MLMediaPlayerPollingStateFlag_HasReceivedInfo = 1 << 7,
MLMediaPlayerPollingStateFlag_HasReceivedError = 1 << 8,
MLMediaPlayerPollingStateFlag_HasTimedTextUpdated = 1 << 9,
MLMediaPlayerPollingStateFlag_HasSubtitleUpdated = 1 << 10,
MLMediaPlayerPollingStateFlag_HasMetadataUpdated = 1 << 11,
MLMediaPlayerPollingStateFlag_HasDrmInfoUpdated = 1 << 12,
MLMediaPlayerPollingStateFlag_HasResetCompleted = 1 << 13,
MLMediaPlayerPollingStateFlag_Ensure32Bits = 0x7FFFFFFF
} MLMediaPlayerPollingStateFlags;

typedef enum MLMediaPlayerInfo {
MLMediaPlayerInfo_Unknown = 1,
MLMediaPlayerInfo_StartedAsNext = 2,
MLMediaPlayerInfo_RenderingStart = 3,
MLMediaPlayerInfo_Looping = 4,
MLMediaPlayerInfo_Started = 5,
MLMediaPlayerInfo_Paused = 6,
MLMediaPlayerInfo_Stopped = 7,
MLMediaPlayerInfo_StartedBySharedPlayer = 8,
MLMediaPlayerInfo_PausedBySharedPlayer = 9,
MLMediaPlayerInfo_SeekBySharedPlayer = 10,
MLMediaPlayerInfo_StoppedBySharedPlayer = 11,
MLMediaPlayerInfo_SyncStart = 12,
MLMediaPlayerInfo_SyncComplete = 13,
MLMediaPlayerInfo_VideoTrackLagging = 700,
MLMediaPlayerInfo_BufferingStart = 701,
MLMediaPlayerInfo_BufferingEnd = 702,
MLMediaPlayerInfo_NetworkBandwidth = 703,
MLMediaPlayerInfo_BehindLiveWindow = 704,
MLMediaPlayerInfo_PowerStatePause = 705,
MLMediaPlayerInfo_PowerStateResume = 706,
MLMediaPlayerInfo_BufferedDuration = 707,
MLMediaPlayerInfo_BadInterleaving = 800,
MLMediaPlayerInfo_NotSeekable = 801,
MLMediaPlayerInfo_MetadataUpdate = 802,
MLMediaPlayerInfo_PlayAudioError = 804,
MLMediaPlayerInfo_PlayVideoError = 805,
MLMediaPlayerInfo_TimedTextError = 900,
MLMediaPlayerInfo_Ensure32Bits = 0x7FFFFFFF
} MLMediaPlayerInfo;

typedef enum MLMediaPlayerTrackType {
MLMediaPlayerTrackType_Unknown = 0,
MLMediaPlayerTrackType_Video = 1,
MLMediaPlayerTrackType_Audio = 2,
MLMediaPlayerTrackType_TimedText = 3,
MLMediaPlayerTrackType_Subtitle = 4,
MLMediaPlayerTrackType_Metadata = 5,
MLMediaPlayerTrackType_Ensure32Bits = 0x7FFFFFFF
} MLMediaPlayerTrackType;

typedef MLPSSHEntry MLMediaPlayerPSSHEntry;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerTrackDRMInfo {
size_t pssh_info_count;
MLMediaPlayerPSSHEntry *pssh_info;
size_t uuid_count;
MLUUID *UUIDs;
MLMediaPlayerTrackType track_type;
} MLMediaPlayerTrackDRMInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerSubtitleData {
uint32_t track_index;
uint64_t start_time_us;
uint64_t duration_us;
uint32_t data_size;
uint8_t *data;
} MLMediaPlayerSubtitleData;

typedef enum MLMediaPlayerBufferingMode {
MLMediaPlayerBufferingMode_None = 0,
MLMediaPlayerBufferingMode_TimeOnly = 1,
MLMediaPlayerBufferingMode_SizeOnly = 2,
MLMediaPlayerBufferingMode_TimeThenSize = 3,
MLMediaPlayerBufferingMode_Count = 4,
MLMediaPlayerBufferingMode_Ensure32Bits = 0x7FFFFFFF
} MLMediaPlayerBufferingMode;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerBufferingSettings {
MLMediaPlayerBufferingMode initial_buffering_mode;
MLMediaPlayerBufferingMode rebuffering_mode;
int32_t initial_watermark_ms;
int32_t initial_watermark_kb;
int32_t rebuffering_watermark_low_ms;
int32_t rebuffering_watermark_high_ms;
int32_t rebuffering_watermark_low_kb;
int32_t rebuffering_watermark_high_kb;
} MLMediaPlayerBufferingSettings;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerOnBufferingUpdateInfo {
int percent;
void *data;
} MLMediaPlayerOnBufferingUpdateInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerOnCompletionInfo {
void *data;
} MLMediaPlayerOnCompletionInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerOnErrorInfo {
MLResult result;
void *data;
} MLMediaPlayerOnErrorInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerOnInfoInfo {
MLMediaPlayerInfo info;
int extra;
void *data;
} MLMediaPlayerOnInfoInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerOnPreparedInfo {
void *data;
} MLMediaPlayerOnPreparedInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerOnSeekCompleteInfo {
void *data;
} MLMediaPlayerOnSeekCompleteInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerOnVideoSizeChangedInfo {
int width;
int height;
void *data;
} MLMediaPlayerOnVideoSizeChangedInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerOnTrackDRMInfo {
MLMediaPlayerTrackDRMInfo *track_info;
void* data;
} MLMediaPlayerOnTrackDRMInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerOnResetCompleteInfo {
void *data;
} MLMediaPlayerOnResetCompleteInfo;

typedef enum {
MLMediaFramePackingMode_None = 0,
MLMediaFramePackingMode_Checkboard,
MLMediaFramePackingMode_ColumnInterleaved,
MLMediaFramePackingMode_RowInterleaved,
MLMediaFramePackingMode_SideBySideQuincunx,
MLMediaFramePackingMode_SideBySide,
MLMediaFramePackingMode_TopBottom,
MLMediaFramePackingMode_MultiviewFrameByFrame,
MLMediaFramePackingMode_FrameByFrame,
MLMediaFramePackingMode_Anaglyph,
} MLMediaFramePackingMode;

typedef enum {
MLMediaFramePackingFlags_None = 0,
MLMediaFramePackingFlags_RightViewFirst = 1 << 0,
MLMediaFramePackingFlags_LeftFlipped = 1 << 1,
MLMediaFramePackingFlags_RightFlipped = 1 << 2,
MLMediaFramePackingFlags_Anaglyph_RedCyan = 1 << 3,
MLMediaFramePackingFlags_Anaglyph_GreenMagenta = 1 << 4,
} MLMediaFramePackingFlags;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerOnFramePackingInfo {
MLMediaFramePackingMode mode;
MLMediaFramePackingFlags flags;
void *data;
} MLMediaPlayerOnFramePackingInfo;

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerEventCallbacksEx {
uint32_t version;
void (*on_buffering_update)(MLHandle media_player, const MLMediaPlayerOnBufferingUpdateInfo *update_info);
void (*on_completion)(MLHandle media_player, const MLMediaPlayerOnCompletionInfo *completion_info);
void (*on_error)(MLHandle media_player, const MLMediaPlayerOnErrorInfo *error_info);
void (*on_info)(MLHandle media_player, const MLMediaPlayerOnInfoInfo *info);
void (*on_prepared)(MLHandle media_player, const MLMediaPlayerOnPreparedInfo *prepared_info);
void (*on_seek_complete)(MLHandle media_player, const MLMediaPlayerOnSeekCompleteInfo *seek_complete_info);
void (*on_video_size_changed)(MLHandle media_player, const MLMediaPlayerOnVideoSizeChangedInfo *video_size_info);
void (*on_track_drm_info)(MLHandle media_player, const MLMediaPlayerOnTrackDRMInfo *track_drm_info);
void (*on_reset_complete)(MLHandle media_player, const MLMediaPlayerOnResetCompleteInfo *reset_complete_info);
void (*on_frame_packing)(MLHandle media_player, const MLMediaPlayerOnFramePackingInfo *frame_packing_info);
} MLMediaPlayerEventCallbacksEx;

ML_STATIC_INLINE void MLMediaPlayerEventCallbacksExInit(MLMediaPlayerEventCallbacksEx *inout_callbacks) {
if (inout_callbacks) {
inout_callbacks->version = 2;
inout_callbacks->on_buffering_update = NULL;
inout_callbacks->on_completion = NULL;
inout_callbacks->on_error = NULL;
inout_callbacks->on_info = NULL;
inout_callbacks->on_prepared = NULL;
inout_callbacks->on_seek_complete = NULL;
inout_callbacks->on_video_size_changed = NULL;
inout_callbacks->on_track_drm_info = NULL;
inout_callbacks->on_reset_complete = NULL;
inout_callbacks->on_frame_packing = NULL;
}
}

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerTrackInfo {
uint32_t version;
MLMediaPlayerTrackType track_type;
} MLMediaPlayerTrackInfo;

ML_STATIC_INLINE void MLMediaPlayerTrackInfoInit(MLMediaPlayerTrackInfo *inout_track_info) {
if (inout_track_info) {
inout_track_info->version = 1;
inout_track_info->track_type = MLMediaPlayerTrackType_Unknown;
}
}

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerTrackDRMSessionInfo {
uint32_t version;
MLMediaPlayerTrackType track_type;
const MLUUID *uuid;
const MLMediaDRMByteArray *session_id;
} MLMediaPlayerTrackDRMSessionInfo;

ML_STATIC_INLINE void MLMediaPlayerTrackDRMSessionInfoInit(MLMediaPlayerTrackDRMSessionInfo *inout_drm_session_info) {
if (inout_drm_session_info) {
inout_drm_session_info->version = 1;
inout_drm_session_info->track_type = MLMediaPlayerTrackType_Unknown;
inout_drm_session_info->uuid = NULL;
inout_drm_session_info->session_id = NULL;
}
}

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerCreate(MLHandle *out_handle);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerDestroy(MLHandle media_player);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetDataSourceForFD(MLHandle media_player, int32_t fd);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetOffsetDataSourceForFD(MLHandle media_player, int32_t fd, int64_t offset, int64_t length);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetDataSourceForPath(MLHandle media_player, const char *path);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetDataSourceForURI(MLHandle media_player, const char *uri);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetRemoteDataSourceForURI(MLHandle media_player, const char *uri, char **headers, size_t len);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetMediaDataSource(MLHandle media_player, MLHandle media_data_source);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetMediaStreamSource(MLHandle media_player, MLHandle media_stream_source);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerAddTimedTextSourceForURI(MLHandle media_player, const char *uri, const char *mime_type);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerAddTimedTextSourceForFD(MLHandle media_player, int32_t fd, int64_t offset, int64_t length, const char *mime_type);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetNextPlayer(MLHandle media_player, MLHandle next_media_player);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetTrackCount(MLHandle media_player, uint32_t *out_track_count);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetTrackType(MLHandle media_player, uint32_t track, MLMediaPlayerTrackType *out_track_type);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetTrackLanguage(MLHandle media_player, uint32_t track, char **out_track_language);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetTrackMediaFormat(MLHandle media_player, uint32_t track, MLHandle *out_media_format);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSelectTrack(MLHandle media_player, uint32_t track);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerUnselectTrack(MLHandle media_player, uint32_t track);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerPrepare(MLHandle media_player);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerPrepareAsync(MLHandle media_player);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerStart(MLHandle media_player);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerStop(MLHandle media_player);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerPause(MLHandle media_player);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerReset(MLHandle media_player);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSeekTo(MLHandle media_player, int msec, MLMediaSeekMode mode);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetEventCallbacksEx(MLHandle media_player, const MLMediaPlayerEventCallbacksEx *callbacks, void *data);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetVideoSize(MLHandle media_player, int32_t *out_width, int32_t *out_height);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetCurrentPosition(MLHandle media_player, int32_t *out_msec);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetDuration(MLHandle media_player, int32_t *out_msec);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetBufferingUpdate(MLHandle media_player, int32_t *out_percentage);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetInfo(MLHandle media_player, int32_t *out_code, int32_t *out_extra);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetError(MLHandle media_player, MLResult *out_result);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetTimedText(MLHandle media_player, const char **out_text, int32_t *out_start, int32_t *out_end);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetSubtitleEx(MLHandle media_player, MLMediaPlayerSubtitleData **out_subtitle_data);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerReleaseSubtitleEx(MLHandle media_player);

typedef void(*MLMediaPlayerOnMediaSubtitleUpdateCallback)(MLHandle media_player, MLMediaPlayerSubtitleData subtitle_data, void *data);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetOnMediaSubtitleUpdateCallback(MLHandle media_player, MLMediaPlayerOnMediaSubtitleUpdateCallback on_media_subtitle_callback, void *data);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetMetadata(MLHandle media_player, int64_t *out_time, int32_t *out_size, uint8_t **out_buffer);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetVideoScalingMode(MLHandle media_player, MLMediaPlayerVideoScalingMode mode);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetLooping(MLHandle media_player, bool loop);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetVolume(MLHandle media_player, float volume);

ML_DEPRECATED_MSG("This feature is not supported starting 1.2.0.")
ML_API MLResult ML_CALL MLMediaPlayerGetAudioHandle(MLHandle media_player, MLHandle *out_handle);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerPollStates(MLHandle media_player, uint16_t mask, uint16_t *out_polled_states);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetTrackDRMInfo(MLHandle media_player, const MLMediaPlayerTrackInfo *track_info, MLMediaPlayerTrackDRMInfo **out_drm_info);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerPrepareTrackDRM(MLHandle media_player, const MLMediaPlayerTrackDRMSessionInfo *drm_session_info);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerReleaseDRM(MLHandle media_player);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetDefaultBufferingSettings(MLHandle media_player, MLMediaPlayerBufferingSettings *out_buf_settings);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetBufferingSettings(MLHandle media_player, MLMediaPlayerBufferingSettings *out_buf_settings);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetBufferingSettings(MLHandle media_player, MLMediaPlayerBufferingSettings buf_settings);

typedef void(*MLMediaPlayerOnMediaTimedTextUpdateCallback)(MLHandle media_player, MLHandle timed_text, void *data);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetOnMediaTimedTextUpdateCallback(MLHandle media_player, MLMediaPlayerOnMediaTimedTextUpdateCallback on_media_timed_text_callback, void *data);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetWebVTTData(MLHandle media_player, MLHandle timed_text, MLWebVTTData **out_webvtt_data);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetTTMLData(MLHandle media_player, MLHandle timed_text, MLTTMLData **out_ttml_data);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerResetAsync(MLHandle media_player);

typedef ML_DEPRECATED_MSG("Use standard Android SDK APIs.") struct MLMediaPlayerMetrics {
float average_framerate;
int average_video_bitrate;
int average_audio_bitrate;
} MLMediaPlayerMetrics;

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerGetMetrics(MLHandle media_player, MLMediaPlayerMetrics *out_metrics);

ML_DEPRECATED_MSG("Use standard Android SDK APIs.")
ML_API MLResult ML_CALL MLMediaPlayerSetSurface(MLHandle media_player, MLHandle surface);
ML_EXTERN_C_END