ml_media_player.h
Classes
Name | |
---|---|
struct | MLMediaPlayerTrackDRMInfo MediaPlayer DRM Info for a Media Track . |
struct | MLMediaPlayerSubtitleData |
struct | MLMediaPlayerBufferingSettings |
struct | MLMediaPlayerOnBufferingUpdateInfo MediaPlayer Buffering update callback Info. |
struct | MLMediaPlayerOnCompletionInfo MediaPlayer Playback completion callback Info. |
struct | MLMediaPlayerOnErrorInfo MediaPlayer Error callback Info. |
struct | MLMediaPlayerOnInfoInfo MediaPlayer Information callback Info. |
struct | MLMediaPlayerOnPreparedInfo MediaPlayer Playback prepared callback Info. |
struct | MLMediaPlayerOnSeekCompleteInfo MediaPlayer Playback seek completion callback Info. |
struct | MLMediaPlayerOnVideoSizeChangedInfo MediaPlayer Video Size Changed callback Info. |
struct | MLMediaPlayerOnTrackDRMInfo MediaPlayer Track DRM Info callback Info. |
struct | MLMediaPlayerOnResetCompleteInfo MediaPlayer reset completion callback Info. |
struct | MLMediaPlayerOnFramePackingInfo MediaPlayer frame packing callback Info. |
struct | MLMediaPlayerEventCallbacksEx Callbacks for notifying client about Media Player error events. |
struct | MLMediaPlayerTrackInfo MediaPlayer Track Information. |
struct | MLMediaPlayerTrackDRMSessionInfo DRM Session information for a MediaPlayer Track. |
struct | MLMediaPlayerMetrics MediaPlayer metrics data. |
Types
Name | |
---|---|
typedef MLPSSHEntry | MLMediaPlayerPSSHEntry |
typedef struct MLMediaPlayerTrackDRMInfo | MLMediaPlayerTrackDRMInfo MediaPlayer DRM Info for a Media Track . |
typedef struct MLMediaPlayerSubtitleData | MLMediaPlayerSubtitleData |
typedef struct MLMediaPlayerBufferingSettings | MLMediaPlayerBufferingSettings |
typedef struct MLMediaPlayerOnBufferingUpdateInfo | MLMediaPlayerOnBufferingUpdateInfo MediaPlayer Buffering update callback Info. |
typedef struct MLMediaPlayerOnCompletionInfo | MLMediaPlayerOnCompletionInfo MediaPlayer Playback completion callback Info. |
typedef struct MLMediaPlayerOnErrorInfo | MLMediaPlayerOnErrorInfo MediaPlayer Error callback Info. |
typedef struct MLMediaPlayerOnInfoInfo | MLMediaPlayerOnInfoInfo MediaPlayer Information callback Info. |
typedef struct MLMediaPlayerOnPreparedInfo | MLMediaPlayerOnPreparedInfo MediaPlayer Playback prepared callback Info. |
typedef struct MLMediaPlayerOnSeekCompleteInfo | MLMediaPlayerOnSeekCompleteInfo MediaPlayer Playback seek completion callback Info. |
typedef struct MLMediaPlayerOnVideoSizeChangedInfo | MLMediaPlayerOnVideoSizeChangedInfo MediaPlayer Video Size Changed callback Info. |
typedef struct MLMediaPlayerOnTrackDRMInfo | MLMediaPlayerOnTrackDRMInfo MediaPlayer Track DRM Info callback Info. |
typedef struct MLMediaPlayerOnResetCompleteInfo | MLMediaPlayerOnResetCompleteInfo MediaPlayer reset completion callback Info. |
typedef struct MLMediaPlayerOnFramePackingInfo | MLMediaPlayerOnFramePackingInfo MediaPlayer frame packing callback Info. |
typedef struct MLMediaPlayerEventCallbacksEx | MLMediaPlayerEventCallbacksEx Callbacks for notifying client about Media Player error events. |
typedef struct MLMediaPlayerTrackInfo | MLMediaPlayerTrackInfo MediaPlayer Track Information. |
typedef struct MLMediaPlayerTrackDRMSessionInfo | MLMediaPlayerTrackDRMSessionInfo 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 MLMediaPlayerMetrics | MLMediaPlayerMetrics MediaPlayer metrics data. |
Enums
Functions
Name | |
---|---|
void | MLMediaPlayerEventCallbacksExInit(MLMediaPlayerEventCallbacksEx * inout_callbacks) Initializes MediaPlayerEventCallbacks with default values. |
void | MLMediaPlayerTrackInfoInit(MLMediaPlayerTrackInfo * inout_track_info) Initializes Media Track Information with default values. |
void | MLMediaPlayerTrackDRMSessionInfoInit(MLMediaPlayerTrackDRMSessionInfo * inout_drm_session_info) Initializes Media Track DRM Session Information with defult values. |
MLResult | MLMediaPlayerCreate(MLHandle * out_handle) Create a new Media Player object. |
MLResult | MLMediaPlayerDestroy(MLHandle media_player) Destroys a MediaPlayer object. |
MLResult | MLMediaPlayerSetDataSourceForFD(MLHandle media_player, int32_t fd) Sets a file descriptor as the data source. |
MLResult | MLMediaPlayerSetOffsetDataSourceForFD(MLHandle media_player, int32_t fd, int64_t offset, int64_t length) Sets a file descriptor as the data source with offset. |
MLResult | MLMediaPlayerSetDataSourceForPath(MLHandle media_player, const char * path) Sets a local file path as the data source. |
MLResult | MLMediaPlayerSetDataSourceForURI(MLHandle media_player, const char * uri) Sets a URI string as the data source. |
MLResult | MLMediaPlayerSetRemoteDataSourceForURI(MLHandle media_player, const char * uri, char ** headers, size_t len) Sets a URI string as the remote data source. |
MLResult | MLMediaPlayerSetMediaDataSource(MLHandle media_player, MLHandle media_data_source) Sets the data source to use. |
MLResult | MLMediaPlayerSetMediaStreamSource(MLHandle media_player, MLHandle media_stream_source) Sets the data source to use. |
MLResult | MLMediaPlayerAddTimedTextSourceForURI(MLHandle media_player, const char uri, const char mime_type) Adds a TimedText source from a URI. |
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. |
MLResult | MLMediaPlayerSetNextPlayer(MLHandle media_player, MLHandle next_media_player) Sets the 'next' Media Player to automatically 'start' when current Media Player playback completes. |
MLResult | MLMediaPlayerGetTrackCount(MLHandle media_player, uint32_t * out_track_count) Counts the number of tracks found in the data source. |
MLResult | MLMediaPlayerGetTrackType(MLHandle media_player, uint32_t track, MLMediaPlayerTrackType * out_track_type) Gets the type of a track. |
MLResult | MLMediaPlayerGetTrackLanguage(MLHandle media_player, uint32_t track, char ** out_track_language) Gets the language of a track. |
MLResult | MLMediaPlayerGetTrackMediaFormat(MLHandle media_player, uint32_t track, MLHandle * out_media_format) Gets the Media Format of a track. |
MLResult | MLMediaPlayerSelectTrack(MLHandle media_player, uint32_t track) Selects a track. |
MLResult | MLMediaPlayerUnselectTrack(MLHandle media_player, uint32_t track) Unselects a track. |
MLResult | MLMediaPlayerPrepare(MLHandle media_player) Prepares the player for playback, synchronously. |
MLResult | MLMediaPlayerPrepareAsync(MLHandle media_player) Prepares the player for playback, asynchronously. |
MLResult | MLMediaPlayerStart(MLHandle media_player) Starts or resumes playback. |
MLResult | MLMediaPlayerStop(MLHandle media_player) Stops playback after playback has been started or paused. |
MLResult | MLMediaPlayerPause(MLHandle media_player) Pauses playback. |
MLResult | MLMediaPlayerReset(MLHandle media_player) Resets the Media Player to its uninitialized state. |
MLResult | MLMediaPlayerSeekTo(MLHandle media_player, int msec, MLMediaSeekMode mode) Seeks to specified time position. |
MLResult | MLMediaPlayerSetEventCallbacksEx(MLHandle media_player, const MLMediaPlayerEventCallbacksEx callbacks, void data) Sets callbacks to notify clients about player events. |
MLResult | MLMediaPlayerGetVideoSize(MLHandle media_player, int32_t out_width, int32_t out_height) Returns the size of the video frame. |
MLResult | MLMediaPlayerGetCurrentPosition(MLHandle media_player, int32_t * out_msec) Returns current position of playback. |
MLResult | MLMediaPlayerGetDuration(MLHandle media_player, int32_t * out_msec) Returns media duration. |
MLResult | MLMediaPlayerGetBufferingUpdate(MLHandle media_player, int32_t * out_percentage) Returns current buffering percentage. |
MLResult | MLMediaPlayerGetInfo(MLHandle media_player, int32_t out_code, int32_t out_extra) Returns last info received by internal Media Player. |
MLResult | MLMediaPlayerGetError(MLHandle media_player, MLResult * out_result) Returns last error received by internal Media Player. |
MLResult | MLMediaPlayerGetTimedText(MLHandle media_player, const char * out_text, int32_t out_start, int32_t * out_end) Returns last timed text event information. |
MLResult | MLMediaPlayerGetSubtitleEx(MLHandle media_player, MLMediaPlayerSubtitleData ** out_subtitle_data) Returns last subtitle event information. |
MLResult | MLMediaPlayerReleaseSubtitleEx(MLHandle media_player) Releases last subtitle event information. |
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. |
MLResult | MLMediaPlayerGetMetadata(MLHandle media_player, int64_t out_time, int32_t out_size, uint8_t ** out_buffer) Returns last metadata event information. |
MLResult | MLMediaPlayerSetVideoScalingMode(MLHandle media_player, MLMediaPlayerVideoScalingMode mode) Sets video scaling mode. |
MLResult | MLMediaPlayerSetLooping(MLHandle media_player, bool loop) Sets the looping mode of the player. |
MLResult | MLMediaPlayerSetVolume(MLHandle media_player, float volume) Sets the volume on this player. |
MLResult | MLMediaPlayerGetAudioHandle(MLHandle media_player, MLHandle * out_handle) Gets the handle of the audio stream. |
MLResult | MLMediaPlayerPollStates(MLHandle media_player, uint16_t mask, uint16_t * out_polled_states) Polls the desired states from internal Media Player. |
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. |
MLResult | MLMediaPlayerPrepareTrackDRM(MLHandle media_player, const MLMediaPlayerTrackDRMSessionInfo * drm_session_info) Prepares DRM for the selected media (either audio or video) track. |
MLResult | MLMediaPlayerReleaseDRM(MLHandle media_player) Releases DRM. |
MLResult | MLMediaPlayerGetDefaultBufferingSettings(MLHandle media_player, MLMediaPlayerBufferingSettings * out_buf_settings) Gets default Buffering settings. |
MLResult | MLMediaPlayerGetBufferingSettings(MLHandle media_player, MLMediaPlayerBufferingSettings * out_buf_settings) Gets current Buffering settings. |
MLResult | MLMediaPlayerSetBufferingSettings(MLHandle media_player, MLMediaPlayerBufferingSettings buf_settings) Sets buffering settings. |
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. |
MLResult | MLMediaPlayerGetWebVTTData(MLHandle media_player, MLHandle timed_text, MLWebVTTData ** out_webvtt_data) Gets WebVTT data represented by a timed text handle. |
MLResult | MLMediaPlayerGetTTMLData(MLHandle media_player, MLHandle timed_text, MLTTMLData ** out_ttml_data) Gets TTML data represented by a timed text handle. |
MLResult | MLMediaPlayerResetAsync(MLHandle media_player) Resets the Media Player to its uninitialized state asynchronously. |
MLResult | MLMediaPlayerGetMetrics(MLHandle media_player, MLMediaPlayerMetrics * out_metrics) Retrieves metrics recorded on the MediaPlayer. |
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. |
Enums Documentation
MLMediaPlayerVideoScalingMode
Enumerator | Value | Description |
---|---|---|
MLMediaPlayerVideoScalingMode_ScaleToFit | 1 | |
MLMediaPlayerVideoScalingMode_ScaleToFitWithCropping | 2 | |
MLMediaPlayerVideoScalingMode_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Codes for setting video scaling mode.
MLMediaPlayerPollingStateFlags
Enumerator | Value | Description |
---|---|---|
MLMediaPlayerPollingStateFlag_IsPlaying | 1 << 0 | Playing. |
MLMediaPlayerPollingStateFlag_IsLooping | 1 << 1 | Looping. |
MLMediaPlayerPollingStateFlag_HasBeenPrepared | 1 << 2 | Prepared. |
MLMediaPlayerPollingStateFlag_HasPlaybackCompleted | 1 << 3 | Playback completed. |
MLMediaPlayerPollingStateFlag_HasSeekCompleted | 1 << 4 | Seek completed. |
MLMediaPlayerPollingStateFlag_HasSizeChanged | 1 << 5 | Size changed. |
MLMediaPlayerPollingStateFlag_HasBufferingUpdated | 1 << 6 | Buffering updated. |
MLMediaPlayerPollingStateFlag_HasReceivedInfo | 1 << 7 | Received info. |
MLMediaPlayerPollingStateFlag_HasReceivedError | 1 << 8 | Received error. |
MLMediaPlayerPollingStateFlag_HasTimedTextUpdated | 1 << 9 | Timed text updated. |
MLMediaPlayerPollingStateFlag_HasSubtitleUpdated | 1 << 10 | Subtitle updated. |
MLMediaPlayerPollingStateFlag_HasMetadataUpdated | 1 << 11 | Metadata updated. |
MLMediaPlayerPollingStateFlag_HasDrmInfoUpdated | 1 << 12 | DRM info updated. |
MLMediaPlayerPollingStateFlag_HasResetCompleted | 1 << 13 | Async Reset completed. |
MLMediaPlayerPollingStateFlag_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
The state to be polled.
MLMediaPlayerInfo
Enumerator | Value | Description |
---|---|---|
MLMediaPlayerInfo_Unknown | 1 | Unknown. |
MLMediaPlayerInfo_StartedAsNext | 2 | The player was started because it was used as the next player. |
MLMediaPlayerInfo_RenderingStart | 3 | The player just pushed the very first video frame for rendering. |
MLMediaPlayerInfo_Looping | 4 | The player just reached EOS and started from beginning (loop). |
MLMediaPlayerInfo_Started | 5 | The player acknowledgement that it has started playing. |
MLMediaPlayerInfo_Paused | 6 | The player acknowledgement that it has paused. |
MLMediaPlayerInfo_Stopped | 7 | The player acknowledgement that it has stopped playing. |
MLMediaPlayerInfo_StartedBySharedPlayer | 8 | The player acknowledgement that it has started playing as result of shared player's request. |
MLMediaPlayerInfo_PausedBySharedPlayer | 9 | The player acknowledgement that it has paused playing as result of shared player's request. |
MLMediaPlayerInfo_SeekBySharedPlayer | 10 | The player acknowledgement that it is seeking as result of shared player's request. |
MLMediaPlayerInfo_StoppedBySharedPlayer | 11 | The player acknowledgement that it has stopped playing as result of shared player's request. |
MLMediaPlayerInfo_SyncStart | 12 | The player has started sync'ing with other shared players. |
MLMediaPlayerInfo_SyncComplete | 13 | The player has completed sync'ing with other shared players. |
MLMediaPlayerInfo_VideoTrackLagging | 700 | The video is too complex for the decoder, it can't decode frames fast enough. |
MLMediaPlayerInfo_BufferingStart | 701 | Media player is temporarily pausing playback. |
MLMediaPlayerInfo_BufferingEnd | 702 | Media player is resuming playback after filling buffers. |
MLMediaPlayerInfo_NetworkBandwidth | 703 | Network bandwidth info. |
MLMediaPlayerInfo_BehindLiveWindow | 704 | Dash Live stream is Behind Live Window. |
MLMediaPlayerInfo_PowerStatePause | 705 | Playback Paused because of Power State Transition. |
MLMediaPlayerInfo_PowerStateResume | 706 | Playback Resumed because of Power State Transition. |
MLMediaPlayerInfo_BufferedDuration | 707 | Duration in milliseconds of buffered content. |
MLMediaPlayerInfo_BadInterleaving | 800 | Bad interleaving means that a media has been improperly interleaved. |
MLMediaPlayerInfo_NotSeekable | 801 | The media is not seekable (e.g live stream). |
MLMediaPlayerInfo_MetadataUpdate | 802 | New media metadata is available. |
MLMediaPlayerInfo_PlayAudioError | 804 | Audio can not be played. |
MLMediaPlayerInfo_PlayVideoError | 805 | Video can not be played. |
MLMediaPlayerInfo_TimedTextError | 900 | Media timed text error. |
MLMediaPlayerInfo_Ensure32Bits | 0x7FFFFFFF | Ensure 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
Enumerator | Value | Description |
---|---|---|
MLMediaPlayerTrackType_Unknown | 0 | Unknown. |
MLMediaPlayerTrackType_Video | 1 | Video. |
MLMediaPlayerTrackType_Audio | 2 | Audio. |
MLMediaPlayerTrackType_TimedText | 3 | Timed text. |
MLMediaPlayerTrackType_Subtitle | 4 | Subtitle. |
MLMediaPlayerTrackType_Metadata | 5 | Metadata. |
MLMediaPlayerTrackType_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
MediaTrack types returned by MLMediaPlayerGetTrackType().
MLMediaPlayerBufferingMode
Enumerator | Value | Description |
---|---|---|
MLMediaPlayerBufferingMode_None | 0 | Do not support buffering. |
MLMediaPlayerBufferingMode_TimeOnly | 1 | Support only time based buffering. |
MLMediaPlayerBufferingMode_SizeOnly | 2 | Support only size based buffering. |
MLMediaPlayerBufferingMode_TimeThenSize | 3 | Support 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_Count | 4 | Number of modes. |
MLMediaPlayerBufferingMode_Ensure32Bits | 0x7FFFFFFF | Ensure enum size is 32 bits. |
Indicate the mode of buffering settings.
MLMediaFramePackingMode
Enumerator | Value | Description |
---|---|---|
MLMediaFramePackingMode_None | 0 | Not a stereoscopic video. |
MLMediaFramePackingMode_Checkboard | Checkboard. | |
MLMediaFramePackingMode_ColumnInterleaved | Column interleaved. | |
MLMediaFramePackingMode_RowInterleaved | Row interleaved. | |
MLMediaFramePackingMode_SideBySideQuincunx | Side by side quincunx. | |
MLMediaFramePackingMode_SideBySide | Side by side. | |
MLMediaFramePackingMode_TopBottom | Top bottom. | |
MLMediaFramePackingMode_MultiviewFrameByFrame | Multiview frame by frame. | |
MLMediaFramePackingMode_FrameByFrame | Frame by frame. | |
MLMediaFramePackingMode_Anaglyph | Anaglyph. |
Frame Packing Arrangement for stereoscopic videos.
API Level:
- 8
MLMediaFramePackingFlags
Enumerator | Value | Description |
---|---|---|
MLMediaFramePackingFlags_None | 0 | No flags. |
MLMediaFramePackingFlags_RightViewFirst | 1 << 0 | Right view first. |
MLMediaFramePackingFlags_LeftFlipped | 1 << 1 | Left view flipped. |
MLMediaFramePackingFlags_RightFlipped | 1 << 2 | Right view flipped. |
MLMediaFramePackingFlags_Anaglyph_RedCyan | 1 << 3 | Anaglyph red/cyan. |
MLMediaFramePackingFlags_Anaglyph_GreenMagenta | 1 << 4 | Anaglyph green/magenta. |
Frame Packing Arrangement flags for stereoscopic videos.
API Level:
- 8
Types Documentation
MLMediaPlayerPSSHEntry
typedef MLPSSHEntry MLMediaPlayerPSSHEntry;
MLMediaPlayerTrackDRMInfo
typedef struct MLMediaPlayerTrackDRMInfo MLMediaPlayerTrackDRMInfo;
MediaPlayer DRM Info for a Media Track .
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerSubtitleData
typedef struct MLMediaPlayerSubtitleData MLMediaPlayerSubtitleData;
MediaPlayer subtitle data.
MLMediaPlayerBufferingSettings
typedef struct MLMediaPlayerBufferingSettings MLMediaPlayerBufferingSettings;
Indicate the buffering settings.
MLMediaPlayerOnBufferingUpdateInfo
typedef struct MLMediaPlayerOnBufferingUpdateInfo MLMediaPlayerOnBufferingUpdateInfo;
MediaPlayer Buffering update callback Info.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerOnCompletionInfo
typedef struct MLMediaPlayerOnCompletionInfo MLMediaPlayerOnCompletionInfo;
MediaPlayer Playback completion callback Info.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerOnErrorInfo
typedef struct MLMediaPlayerOnErrorInfo MLMediaPlayerOnErrorInfo;
MediaPlayer Error callback Info.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerOnInfoInfo
typedef struct MLMediaPlayerOnInfoInfo MLMediaPlayerOnInfoInfo;
MediaPlayer Information callback Info.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerOnPreparedInfo
typedef struct MLMediaPlayerOnPreparedInfo MLMediaPlayerOnPreparedInfo;
MediaPlayer Playback prepared callback Info.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerOnSeekCompleteInfo
typedef struct MLMediaPlayerOnSeekCompleteInfo MLMediaPlayerOnSeekCompleteInfo;
MediaPlayer Playback seek completion callback Info.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerOnVideoSizeChangedInfo
typedef struct MLMediaPlayerOnVideoSizeChangedInfo MLMediaPlayerOnVideoSizeChangedInfo;
MediaPlayer Video Size Changed callback Info.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerOnTrackDRMInfo
typedef struct MLMediaPlayerOnTrackDRMInfo MLMediaPlayerOnTrackDRMInfo;
MediaPlayer Track DRM Info callback Info.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerOnResetCompleteInfo
typedef struct MLMediaPlayerOnResetCompleteInfo MLMediaPlayerOnResetCompleteInfo;
MediaPlayer reset completion callback Info.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 8
MLMediaPlayerOnFramePackingInfo
typedef struct MLMediaPlayerOnFramePackingInfo MLMediaPlayerOnFramePackingInfo;
MediaPlayer frame packing callback Info.
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().
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 8
MLMediaPlayerTrackInfo
typedef struct MLMediaPlayerTrackInfo MLMediaPlayerTrackInfo;
MediaPlayer Track Information.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerTrackDRMSessionInfo
typedef struct MLMediaPlayerTrackDRMSessionInfo MLMediaPlayerTrackDRMSessionInfo;
DRM Session information for a MediaPlayer Track.
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
data | Custom data to be returned when callback is fired. | |
media_player | MLHandle is a Media Player instance for which callback was called. | |
subtitle_data | MLMediaPlayerSubtitleData 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_player | MLHandle is a Media Player instance for which callback was called. | |
timed_text | MLHandle is the handle for timed_text data. | |
data | Custom data to be delivered when callback is invoked. |
Required Permissions:
- None
API Level:
- 4
MLMediaPlayerMetrics
typedef struct MLMediaPlayerMetrics MLMediaPlayerMetrics;
MediaPlayer metrics data.
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_callbacks | Media 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_info | Media 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_info | Media 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_handle | The MLHandle to the new Media Player object created. Only valid if result is MLResult_Ok. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully created MediaPlayer. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
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
MLHandle | media_player | MLHandle to the Media Player object to destroy. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully destroyed MediaPlayer. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
int32_t | fd | The file descriptor for the file you want to play. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set file descriptor. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed 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 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
MLHandle | media_player | Handle to the MediaPlayer instance. |
int32_t | fd | The file descriptor for the file you want to play. |
int64_t | offset | The offset (in bytes) of the source's start. |
int64_t | length | The number of bytes of media to load after offset. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set file descriptor. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed 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 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
MLHandle | media_player | Handle to the MediaPlayer instance. |
const char * | path | The linux-style path of the file. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set local file path. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
The path should be an absolute path and should reference a world-readable file.
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
const char * | uri | The C-style string representing the URI complete string. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set URI string. |
MLResult | MLResult_PermissionDenied | Failed due to lack of permission. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed 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 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
MLHandle | media_player | Handle to the MediaPlayer instance. |
const char * | uri | The C-style string representing the complete URL. |
char ** | headers | Array of char * headers to be sent. |
size_t | len | Number of headers passed. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set URI string. |
MLResult | MLResult_PermissionDenied | Failed due to lack of permission. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- android.permission.INTERNET (protection level: normal)
Supported URI schemes are file
, http
, https
, and rtsp
.
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLHandle | media_data_source | MLHandle returned by MLMediaDataSourceCreate(). |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set the data source to use. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NameNotFound | Failed because no valid source could be found. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLHandle | media_stream_source | MLHandle returned by MLMediaStreamSourceCreate(). |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set the data source to use. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NameNotFound | Failed because no valid source could be found. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
const char * | uri | The C-style string representing the complete URI. |
const char * | mime_type | The MIME type of the file. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully added TimedText source from URI. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown failure. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
int32_t | fd | The file descriptor for the timed text source. |
int64_t | offset | The offset (in bytes) of the source's start. Must be >= 0. |
int64_t | length | The number of bytes of media to load after offset. Must be >= 0. |
const char * | mime_type | The MIME type of the file. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully added TimedText source from file descriptor. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown failure. |
MLResult | MLMediaGenericResult_NoInit | Failed 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 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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLHandle | next_media_player | MLHandle of an already created Media Player instance. To 'remove' the next player, set next_media_player = 0. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully registered next Media Player. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NameNotFound | Failed source because no valid source could be found. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
uint32_t * | out_track_count | The number of tracks found in the player source. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned the number of tracks. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
uint32_t | track | The track number for which type is to be returned. Has to be < TrackCount. |
MLMediaPlayerTrackType * | out_track_type | The returned type for specified track number. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned type for passed track. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NameNotFound | Found track's type was unknown. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
uint32_t | track | The track number for which language is to be returned. Has to be < TrackCount. |
char ** | out_track_language | The returned language of the track. Caller has ownership of that param and has to free it when no longer needed. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned language for passed track. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
uint32_t | track | The track number for which Media Format is to be returned. Has to be < TrackCount. |
MLHandle * | out_media_format | MLHandle to MediaFormat of the track. Caller has ownership of this handle and should call MLMediaFormatDestroy to free it when no longer needed. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully retreived the media format of passed track. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerSelectTrack
MLResult MLMediaPlayerSelectTrack(
MLHandle media_player,
uint32_t track
)
Selects a track.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
uint32_t | track | Number of the track to select. Has to be < TrackCount. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully selected track. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerUnselectTrack
MLResult MLMediaPlayerUnselectTrack(
MLHandle media_player,
uint32_t track
)
Unselects a track.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
uint32_t | track | Number of the track to unselect. Has to be < TrackCount. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully unselected track. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerPrepare
MLResult MLMediaPlayerPrepare(
MLHandle media_player
)
Prepares the player for playback, synchronously.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully prepared the player. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. Can only be called after one of the setDataSource methods or in the 'stopped' state. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
MLResult | MLMediaResult_CannotConnect | Failed 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 since 1.4.0. Scheduled for removal.
MLMediaPlayerPrepareAsync
MLResult MLMediaPlayerPrepareAsync(
MLHandle media_player
)
Prepares the player for playback, asynchronously.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully prepared the player asynchronously. For result, poll for MLMediaPlayerPollingStateFlag_HasBeenPrepared state or wait for 'on_prepared' callback if already set. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. Can only be called after one of the setDataSource methods or in the 'stopped' state. |
MLResult | MLMediaGenericResult_NoInit | Failed 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 since 1.4.0. Scheduled for removal.
MLMediaPlayerStart
MLResult MLMediaPlayerStart(
MLHandle media_player
)
Starts or resumes playback.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully started/resumed playback. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. Can only be called in one of the following states: 'prepared', 'playback complete', 'paused', 'stopped'. |
MLResult | MLMediaGenericResult_NoInit | Failed 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 since 1.4.0. Scheduled for removal.
MLMediaPlayerStop
MLResult MLMediaPlayerStop(
MLHandle media_player
)
Stops playback after playback has been started or paused.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully stopped playback. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. Can only be called in one of the following states: 'playing', 'paused', 'stopped', 'prepared', 'playback complete'. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerPause
MLResult MLMediaPlayerPause(
MLHandle media_player
)
Pauses playback.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully paused playback. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. Can only be called in one of the following states: 'playing', 'paused', 'playback complete'. |
MLResult | MLMediaGenericResult_NoInit | Failed 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 since 1.4.0. Scheduled for removal.
MLMediaPlayerReset
MLResult MLMediaPlayerReset(
MLHandle media_player
)
Resets the Media Player to its uninitialized state.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully reset MediaPlayer. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. This method can be called anytime except when in 'preparing async'. |
MLResult | MLMediaGenericResult_NoInit | Failed 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 since 1.4.0. Scheduled for removal.
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
int | msec | The offset in milliseconds from the start, to seek to. |
MLMediaSeekMode | mode | Seek mode defined by MLMediaSeekMode. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully launched seek operation asynchronously. For result, poll for MLMediaPlayerPollingStateFlag_HasSeekCompleted state or wait for the 'on_seek_complete' callback if already set. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. This method can only be called from the following states: 'started', 'prepared', 'paused' and 'playback complete'. |
MLResult | MLMediaGenericResult_NoInit | Failed 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 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
MLHandle | media_player | MLHandle to the MediaCodec. |
const MLMediaPlayerEventCallbacksEx * | callbacks | Set of event callbacks. Can be set to NULL to unset the callbacks altogether. |
void * | data | Custom data to be returned when any callback is fired. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set/unset the specified callbacks. |
MLResult | MLResult_UnspecifiedFailure | Failed 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 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
MLHandle | media_player | Handle to the MediaPlayer instance. |
int32_t * | out_width | The returned video width. |
int32_t * | out_height | The returned video height. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned video size. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerGetCurrentPosition
MLResult MLMediaPlayerGetCurrentPosition(
MLHandle media_player,
int32_t * out_msec
)
Returns current position of playback.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
int32_t * | out_msec | The returned position in milliseconds. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned current position. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerGetDuration
MLResult MLMediaPlayerGetDuration(
MLHandle media_player,
int32_t * out_msec
)
Returns media duration.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
int32_t * | out_msec | The returned duration in milliseconds. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned the media duration. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed 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'. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerGetBufferingUpdate
MLResult MLMediaPlayerGetBufferingUpdate(
MLHandle media_player,
int32_t * out_percentage
)
Returns current buffering percentage.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
int32_t * | out_percentage | The returned buffering percentage in the range [0, 100]. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned current buffering percentage. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
int32_t * | out_code | The main info code. |
int32_t * | out_extra | The secondary code/data. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned the last MediaPlayer. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLResult * | out_result | The result code. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned the last MediaPlayer error. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
const char ** | out_text | The text of the timed text event. |
int32_t * | out_start | The start time. |
int32_t * | out_end | The end time. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned the last timedtext entry. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerGetSubtitleEx
MLResult MLMediaPlayerGetSubtitleEx(
MLHandle media_player,
MLMediaPlayerSubtitleData ** out_subtitle_data
)
Returns last subtitle event information.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLMediaPlayerSubtitleData ** | out_subtitle_data | The returned MLMediaPlayerGetSubtitleExArgs pointer. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned the last subtitle entry. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerReleaseSubtitleEx
MLResult MLMediaPlayerReleaseSubtitleEx(
MLHandle media_player
)
Releases last subtitle event information.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully released the last subtitle entry. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLMediaPlayerOnMediaSubtitleUpdateCallback | on_media_subtitle_callback | Function 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 * | data | Custom data to be returned when callback is fired. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set callback. |
MLResult | MLResult_UnspecifiedFailure | Failed 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 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
MLHandle | media_player | Handle to the MediaPlayer instance. |
int64_t * | out_time | The returned event time. |
int32_t * | out_size | The returned event buffer size. |
uint8_t ** | out_buffer | The 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
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned last metadata entry. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerSetVideoScalingMode
MLResult MLMediaPlayerSetVideoScalingMode(
MLHandle media_player,
MLMediaPlayerVideoScalingMode mode
)
Sets video scaling mode.
Parameters
MLHandle | media_player | MLHandle to the MediaPlayer instance. |
MLMediaPlayerVideoScalingMode | mode | The video scaling mode to set. For a list of valid values, see #media_video_scaling_mode_type declaration. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned current video scaling mode. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. SetDataSource must be called immediately after creation, or after a media player reset. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerSetLooping
MLResult MLMediaPlayerSetLooping(
MLHandle media_player,
bool loop
)
Sets the looping mode of the player.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
bool | loop | The 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
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned current looping mode. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerSetVolume
MLResult MLMediaPlayerSetVolume(
MLHandle media_player,
float volume
)
Sets the volume on this player.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
float | volume | The new volume in the [0.0, 1.0] range. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set the volume. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLHandle * | out_handle | The MLHandle to the returned Audio handle. Only valid if result is MLResult_Ok. |
Returns
MLResult | MLResult_NotImplemented | If used in versions starting 1.2.0 or later. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
uint16_t | mask | Selection mask for picking which states to retrieve. |
uint16_t * | out_polled_states | Bitwise OR'ed integer of all the chosen states from bitwise 'mask' and in the range [0 = false : 1 = true]. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully polled and returned the selected states. |
MLResult | MLResult_UnspecifiedFailure | Failed 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 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
MLHandle | media_player | Handle to the MediaPlayer instance. |
const MLMediaPlayerTrackInfo * | track_info | Media track information defined by MLMediaPlayerTrackInfo. |
MLMediaPlayerTrackDRMInfo ** | out_drm_info | Pointer 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
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned the current DRM Info. |
MLResult | MLResult_Pending | Media Source is not prepared yet. Wait for on_prepared callback and call again. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
MLResult | MLMediaGenericResult_NotAvailable | DRM 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 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
MLHandle | media_player | Handle to the MediaPlayer instance. |
const MLMediaPlayerTrackDRMSessionInfo * | drm_session_info | DRM Session info for the Media track, as defined by MLMediaPlayerTrackDRMSessionInfo. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully prepared DRM. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 2
MLMediaPlayerReleaseDRM
MLResult MLMediaPlayerReleaseDRM(
MLHandle media_player
)
Releases DRM.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully released DRM. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerGetDefaultBufferingSettings
MLResult MLMediaPlayerGetDefaultBufferingSettings(
MLHandle media_player,
MLMediaPlayerBufferingSettings * out_buf_settings
)
Gets default Buffering settings.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLMediaPlayerBufferingSettings * | out_buf_settings | A pointer to MLMediaPlayerBufferingSettings. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned default Buffering settings. |
MLResult | MLResult_NotImplemented | Feature not implemented in the given model. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
\Attention The API is only implemented in ML1.
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerGetBufferingSettings
MLResult MLMediaPlayerGetBufferingSettings(
MLHandle media_player,
MLMediaPlayerBufferingSettings * out_buf_settings
)
Gets current Buffering settings.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLMediaPlayerBufferingSettings * | out_buf_settings | A pointer to MLMediaPlayerBufferingSettings. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned current Buffering settings. |
MLResult | MLResult_NotImplemented | Feature not implemented in the given model. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
\Attention The API is only implemented in ML1.
Deprecated since 1.4.0. Scheduled for removal.
MLMediaPlayerSetBufferingSettings
MLResult MLMediaPlayerSetBufferingSettings(
MLHandle media_player,
MLMediaPlayerBufferingSettings buf_settings
)
Sets buffering settings.
Parameters
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLMediaPlayerBufferingSettings | buf_settings | An MLMediaPlayerBufferingSettings struct. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully set buffering settings. |
MLResult | MLResult_NotImplemented | Feature not implemented in the given model. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
\Attention The API is only implemented in ML1.
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLMediaPlayerOnMediaTimedTextUpdateCallback | on_media_timed_text_callback | Function pointer to be called. This can be 'NULL' to unset the callback. |
void * | data | Custom data to be returned when callback is fired. |
Returns
MLResult | MLResult_Ok | Successfully set callback. |
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_UnspecifiedFailure | Failed 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 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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLHandle | timed_text | The Timed Text handle. |
MLWebVTTData ** | out_webvtt_data | The WebVTT data structure to be returned. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned WebVTT data. |
MLResult | MLMediaGenericResult_BadType | Failed because the timed_text handle was not in the WebVTT format. The timed text track's mime type must be "text/vtt". |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
The returned MLWebVTTData structure is valid only in the callback's context.
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLHandle | timed_text | The Timed Text handle. |
MLTTMLData ** | out_ttml_data | The TTML data structure to be returned. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully returned TTML data. |
MLResult | MLMediaGenericResult_BadType | Failed because the timed_text handle was not in the TTML format. The timed text track's mime type must be "application/ttml+xml". |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
The returned MLTTMLData structure is valid only in the callback's context.
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully launched MediaPlayer reset operation asynchronously. For result, poll for MLMediaPlayerPollingStateFlag_HasResetCompleted or use the 'on_reset_complete' callback if already set. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. This method can be called anytime except when in 'preparing async'. |
MLResult | MLMediaGenericResult_NoInit | Failed 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 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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLMediaPlayerMetrics * | out_metrics | See MLMediaPlayerMetrics. |
Returns
MLResult | MLResult_InvalidParam | Failed due to an invalid parameter. |
MLResult | MLResult_Ok | Successfully received metrics. |
MLResult | MLResult_UnspecifiedFailure | Failed due to an unknown error. |
MLResult | MLMediaGenericResult_InvalidOperation | Failed because method was called in the wrong state. |
MLResult | MLMediaGenericResult_NoInit | Failed because MediaPlayer was not properly initialized. |
Required Permissions:
- None
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
MLHandle | media_player | Handle to the MediaPlayer instance. |
MLHandle | surface | Handle to the MLNativeSurface object. |
Returns
MLResult | MLResult_InvalidParam | Passed media_player or the surface handle was not found. |
MLResult | MLResult_Ok | Successfully set output surface. |
MLResult | MLResult_UnspecifiedFailure | Internal error. |
MLResult | MLMediaGenericResult_InvalidOperation | Method was called from the wrong state. |
MLResult | MLMediaGenericResult_NoInit | MediaPlayer 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 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