Tizen Native API
|
Functions | |
int | player_create (player_h *player) |
Creates a player handle for playing multimedia content. | |
int | player_destroy (player_h player) |
Destroys the media player handle and releases all its resources. | |
int | player_prepare (player_h player) |
Prepares the media player for playback. | |
int | player_prepare_async (player_h player, player_prepared_cb callback, void *user_data) |
Prepares the media player for playback, asynchronously. | |
int | player_unprepare (player_h player) |
Resets the media player. | |
int | player_set_uri (player_h player, const char *uri) |
Sets the data source (file-path or HTTP URI) to use. | |
int | player_set_memory_buffer (player_h player, const void *data, int size) |
Sets memory as the data source. | |
int | player_get_state (player_h player, player_state_e *state) |
Gets the player's current state. | |
int | player_set_volume (player_h player, float left, float right) |
Sets the player's volume. | |
int | player_get_volume (player_h player, float *left, float *right) |
Gets the player's current volume factor. | |
int | player_set_sound_type (player_h player, sound_type_e type) |
Sets the player's volume type. | |
int | player_set_audio_latency_mode (player_h player, audio_latency_mode_e latency_mode) |
Sets the audio latency mode. | |
int | player_get_audio_latency_mode (player_h player, audio_latency_mode_e *latency_mode) |
Gets the current audio latency mode. | |
int | player_start (player_h player) |
Starts or resumes playback. | |
int | player_stop (player_h player) |
Stops playing media content. | |
int | player_pause (player_h player) |
Pauses the player. | |
int | player_set_play_position (player_h player, int millisecond, bool accurate, player_seek_completed_cb callback, void *user_data) |
Sets the seek position for playback, asynchronously. | |
int | player_get_play_position (player_h player, int *millisecond) |
Gets the current position in milliseconds. | |
int | player_set_mute (player_h player, bool muted) |
Sets the player's mute status. | |
int | player_is_muted (player_h player, bool *muted) |
Gets the player's mute status. | |
int | player_set_looping (player_h player, bool looping) |
Sets the player's looping status. | |
int | player_is_looping (player_h player, bool *looping) |
Gets the player's looping status. | |
int | player_set_display (player_h player, player_display_type_e type, player_display_h display) |
Sets the video display. | |
int | player_set_media_packet_video_frame_decoded_cb (player_h player, player_media_packet_video_decoded_cb callback, void *user_data) |
Registers a media packet video callback function to be called once per frame. | |
int | player_unset_media_packet_video_frame_decoded_cb (player_h player) |
Unregisters the callback function. | |
int | player_capture_video (player_h player, player_video_captured_cb callback, void *user_data) |
Captures the video frame, asynchronously. | |
int | player_set_streaming_cookie (player_h player, const char *cookie, int size) |
Sets the cookie for streaming playback. | |
int | player_set_streaming_user_agent (player_h player, const char *user_agent, int size) |
Sets the streaming user agent for playback. | |
int | player_get_streaming_download_progress (player_h player, int *start, int *current) |
Gets the download progress for streaming playback. | |
int | player_set_completed_cb (player_h player, player_completed_cb callback, void *user_data) |
Registers a callback function to be invoked when the playback is finished. | |
int | player_unset_completed_cb (player_h player) |
Unregisters the callback function. | |
int | player_set_interrupted_cb (player_h player, player_interrupted_cb callback, void *user_data) |
Registers a callback function to be invoked when the playback is interrupted or the interrupt is completed. | |
int | player_unset_interrupted_cb (player_h player) |
Unregisters the callback function. | |
int | player_set_error_cb (player_h player, player_error_cb callback, void *user_data) |
Registers a callback function to be invoked when an error occurs. | |
int | player_unset_error_cb (player_h player) |
Unregisters the callback function. | |
int | player_set_buffering_cb (player_h player, player_buffering_cb callback, void *user_data) |
Registers a callback function to be invoked when there is a change in the buffering status of a media stream. | |
int | player_unset_buffering_cb (player_h player) |
Unregisters the callback function. | |
int | player_set_progressive_download_path (player_h player, const char *path) |
Sets a path to download, progressively. | |
int | player_get_progressive_download_status (player_h player, unsigned long *current, unsigned long *total_size) |
Gets the status of progressive download. | |
int | player_set_progressive_download_message_cb (player_h player, player_pd_message_cb callback, void *user_data) |
Registers a callback function to be invoked when progressive download is started or completed. | |
int | player_unset_progressive_download_message_cb (player_h player) |
Unregisters the callback function. | |
int | player_set_playback_rate (player_h player, float rate) |
Sets the playback rate. | |
Typedefs | |
typedef struct player_s * | player_h |
The media player's type handle. | |
typedef void * | player_display_h |
The player display handle. | |
typedef void(* | player_prepared_cb )(void *user_data) |
Called when the media player is prepared. | |
typedef void(* | player_completed_cb )(void *user_data) |
Called when the media player is completed. | |
typedef void(* | player_seek_completed_cb )(void *user_data) |
Called when the seek operation is completed. | |
typedef void(* | player_interrupted_cb )(player_interrupted_code_e code, void *user_data) |
Called when the media player is interrupted. | |
typedef void(* | player_error_cb )(int error_code, void *user_data) |
Called when an error occurs in the media player. | |
typedef void(* | player_buffering_cb )(int percent, void *user_data) |
Called when the buffering percentage of the media playback is updated. | |
typedef void(* | player_pd_message_cb )(player_pd_message_type_e type, void *user_data) |
Called when progressive download is started or completed. | |
typedef void(* | player_video_captured_cb )(unsigned char *data, int width, int height, unsigned int size, void *user_data) |
Called when the video is captured. | |
typedef void(* | player_media_packet_video_decoded_cb )(media_packet_h pkt, void *user_data) |
Called to register for notifications about delivering media packet when every video frame is decoded. | |
Defines | |
#define | GET_DISPLAY(x) (void*)(x) |
Definition for a display handle from evas object. |
The Player API provides functions for media playback and controlling media playback attributes.
#include <player.h>
The Player API provides a way to play multimedia content. Content can be played from a file, from the network, or from memory. It gives the ability to start/stop/pause/mute, set the playback position (that is, seek), perform various status queries, and control the display.
Additional functions allow registering notifications via callback functions for various state change events.
This API also enables collaboration with the GUI service to present a video.
Playback of multimedia content is controlled by a state machine. The following diagram shows the life cycle and states of the Player.
FUNCTION | PRE-STATE | POST-STATE | SYNC TYPE |
---|---|---|---|
player_create() | NONE | IDLE | SYNC |
player_destroy() | IDLE | NONE | SYNC |
player_prepare() | IDLE | READY | SYNC |
player_prepare_async() | IDLE | READY | ASYNC |
player_unprepare() | READY, PLAYING or PAUSED | IDLE | SYNC |
player_start() | READY or PAUSED | PLAYING | SYNC |
player_stop() | PLAYING | READY | SYNC |
player_pause() | PLAYING | PAUSED | SYNC |
The following table shows state-dependent function calls. It is forbidden to call the functions listed below in wrong states. Violation of this rule may result in unpredictable behavior.
FUNCTION | VALID STATES | DESCRIPTION |
---|---|---|
player_create() | ANY | - |
player_destroy() | ANY | - |
player_prepare() | IDLE | This function must be called after player_create() |
player_unprepare() | READY/PAUSED/PLAYING | This function must be called after player_stop() or player_start() or player_pause() |
player_start() | READY/ PAUSED | This function must be called after player_prepare() |
player_stop() | PLAYING/ PAUSED | This function must be called after player_start() or player_pause() |
player_pause() | PLAYING | This function must be called after player_start() |
player_set_completed_cb() player_set_interrupted_cb() player_set_error_cb() player_set_buffering_cb() player_set_subtitle_updated_cb() | IDLE/ READY/ PLAYING/ PAUSED | This function must be called after player_create() |
player_unset_completed_cb() player_unset_interrupted_cb() player_unset_error_cb() player_unset_buffering_cb() player_unset_subtitle_updated_cb() | IDLE/ READY/ PLAYING/ PAUSED | This function must be called after register callback functions such as player_set_completed_cb() |
player_get_state() | ANY | - |
player_set_uri() | IDLE | This function must be called before player_prepare() |
player_set_memory_buffer() | IDLE | This function must be called before player_prepare() |
player_set_subtitle_path() | IDLE | This function must be called before player_prepare() |
player_set_volume() | IDLE/ READY/ PLAYING/ PAUSED | This function must be called after player_create() |
player_get_volume() | IDLE/ READY/ PLAYING/ PAUSED | This function must be called after player_create() |
player_set_sound_type() | IDLE | This function must be called after player_create() |
player_set_mute() | IDLE/ READY/ PLAYING/ PAUSED | This function must be called after player_create() |
player_is_muted() | IDLE/ READY/ PLAYING/ PAUSED | This function must be called after player_create() |
player_set_looping() | IDLE/ READY/ PLAYING/ PAUSED | This function must be called after player_create() |
player_is_looping() | IDLE/ READY/ PLAYING/ PAUSED | This function must be called after player_create() |
player_get_duration() | PLAYING/ PAUSED | This function must be called after player_start() |
player_set_display() | IDLE | This function must be called before player_prepare() |
player_set_display_mode() player_set_display_visible() | IDLE/ READY/ PLAYING/ PAUSED | This function must be called after player_create() |
player_get_display_rotation() player_is_display_visible() | IDLE/ READY/ PLAYING/ PAUSED | This function must be called after player_create() |
player_get_video_size() | READY/ PLAYING/ PAUSED | This function must be called after player_prepare() |
All functions that change the player state are synchronous except player_prepare_async(), player_set_play_position(), and player_capture_video(). Thus the result is passed to the application via the callback mechanism.
REGISTER | UNREGISTER | CALLBACK | DESCRIPTION |
---|---|---|---|
player_set_completed_cb() | player_unset_completed_cb() | player_completed_cb() | called when playback is completed |
player_set_interrupted_cb() | player_unset_interrupted_cb() | player_interrupted_cb() | called when playback is interrupted by player_interrupted_code_e |
player_set_error_cb() | player_unset_error_cb() | player_error_cb() | called when an error has occurred |
player_set_buffering_cb() | player_unset_buffering_cb() | player_buffering_cb() | called during content buffering |
player_set_progressive_download_message_cb() | player_unset_progressive_download_message_cb() | player_pd_message_cb() | called when a progressive download starts or completes |
player_set_subtitle_updated_cb() | player_unset_subtitle_updated_cb() | player_subtitle_updated_cb() | called when a subtitle updates |
player_set_media_packet_video_frame_decoded_cb() | player_unset_media_packet_video_frame_decoded_cb() | player_media_packet_video_decoded_cb() | called when a video frame is decoded |
#define GET_DISPLAY | ( | x | ) | (void*)(x) |
Definition for a display handle from evas object.
typedef void(* player_buffering_cb)(int percent, void *user_data) |
Called when the buffering percentage of the media playback is updated.
If the buffer is full, it will return 100%.
[in] | percent | The percentage of buffering completed (0~100) |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* player_completed_cb)(void *user_data) |
Called when the media player is completed.
It will be invoked when player has reached the end of the stream.
[in] | user_data | The user data passed from the callback registration function |
typedef void* player_display_h |
The player display handle.
typedef void(* player_error_cb)(int error_code, void *user_data) |
Called when an error occurs in the media player.
[in] | error_code | The error code |
[in] | user_data | The user data passed from the callback registration function |
typedef struct player_s* player_h |
The media player's type handle.
typedef void(* player_interrupted_cb)(player_interrupted_code_e code, void *user_data) |
Called when the media player is interrupted.
[in] | error_code | The interrupted error code |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* player_media_packet_video_decoded_cb)(media_packet_h pkt, void *user_data) |
Called to register for notifications about delivering media packet when every video frame is decoded.
[in] | pkt | Reference pointer to the media packet |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* player_pd_message_cb)(player_pd_message_type_e type, void *user_data) |
Called when progressive download is started or completed.
[in] | type | The message type for progressive download |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* player_prepared_cb)(void *user_data) |
Called when the media player is prepared.
It will be invoked when player has reached the begin of stream.
[in] | user_data | The user data passed from the callback registration function |
typedef void(* player_seek_completed_cb)(void *user_data) |
Called when the seek operation is completed.
[in] | user_data | The user data passed from the callback registration function |
typedef void(* player_video_captured_cb)(unsigned char *data, int width, int height, unsigned int size, void *user_data) |
Called when the video is captured.
[in] | data | The captured image buffer |
[in] | width | The width of the captured image |
[in] | height | The height of the captured image |
[in] | size | The size of the captured image |
[in] | user_data | The user data passed from the callback registration function |
enum audio_latency_mode_e |
enum player_error_e |
Enumeration for media player's error codes.
Enumeration for media player's interruption type.
enum player_state_e |
Enumeration for media player state.
int player_capture_video | ( | player_h | player, |
player_video_captured_cb | callback, | ||
void * | user_data | ||
) |
Captures the video frame, asynchronously.
[in] | player | The handle to the media player |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation Video type should be set using player_set_display() otherwises, audio stream is only processed even though video file is set. |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_create | ( | player_h * | player | ) |
Creates a player handle for playing multimedia content.
[out] | player | A new handle to the media player |
PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_OUT_OF_MEMORY | Out of memory |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_destroy | ( | player_h | player | ) |
Destroys the media player handle and releases all its resources.
[in] | player | The handle to the media player to be destroyed |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_get_audio_latency_mode | ( | player_h | player, |
audio_latency_mode_e * | latency_mode | ||
) |
Gets the current audio latency mode.
[in] | player | The handle to the media player |
[out] | latency_mode | The latency mode to get from the audio |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_get_play_position | ( | player_h | player, |
int * | millisecond | ||
) |
Gets the current position in milliseconds.
[in] | player | The handle to the media player |
[out] | millisecond | The current position in milliseconds |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_SEEK_FAILED | Seek operation failure |
int player_get_progressive_download_status | ( | player_h | player, |
unsigned long * | current, | ||
unsigned long * | total_size | ||
) |
Gets the status of progressive download.
[in] | player | The handle to the media player |
[out] | current | The current download position (bytes) |
[out] | total_size | The total size of the file (bytes) |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_get_state | ( | player_h | player, |
player_state_e * | state | ||
) |
Gets the player's current state.
[in] | player | The handle to the media player |
[out] | state | The current state of the player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
int player_get_streaming_download_progress | ( | player_h | player, |
int * | start, | ||
int * | current | ||
) |
Gets the download progress for streaming playback.
[in] | player | The handle to the media player |
[out] | start | The starting position in percentage [0, 100] |
[out] | current | The current position in percentage [0, 100] |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_get_volume | ( | player_h | player, |
float * | left, | ||
float * | right | ||
) |
Gets the player's current volume factor.
The range of left and right is from 0
to 1.0
, inclusive (1.0 = 100%). This function gets the player volume, not the system volume. To get the system volume, use the Sound Manager API.
[in] | player | The handle to the media player |
[out] | left | The current left volume scalar |
[out] | right | The current right volume scalar |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_is_looping | ( | player_h | player, |
bool * | looping | ||
) |
Gets the player's looping status.
If the looping status is true
, playback automatically restarts upon finishing. If it is false
, it won't.
[in] | player | The handle to the media player |
[out] | looping | The looping status: (true = looping, false = non-looping ) |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_is_muted | ( | player_h | player, |
bool * | muted | ||
) |
Gets the player's mute status.
If the mute status is true
, no sounds are played. If it is false
, sounds are played at the previously set volume level.
[in] | player | The handle to the media player |
[out] | muted | The current mute status: (true = mute, false = not muted) |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_pause | ( | player_h | player | ) |
Pauses the player.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid state |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
PLAYER_ERROR_SOUND_POLICY | Sound policy error |
int player_prepare | ( | player_h | player | ) |
Prepares the media player for playback.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_URI | Invalid URI |
PLAYER_ERROR_NO_SUCH_FILE | File not found |
PLAYER_ERROR_NOT_SUPPORTED_FILE | File not supported |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
PLAYER_ERROR_PERMISSION_DENIED | Permission denied |
int player_prepare_async | ( | player_h | player, |
player_prepared_cb | callback, | ||
void * | user_data | ||
) |
Prepares the media player for playback, asynchronously.
[in] | player | The handle to the media player |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_URI | Invalid URI |
PLAYER_ERROR_NO_SUCH_FILE | File not found |
PLAYER_ERROR_NOT_SUPPORTED_FILE | File not supported |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
PLAYER_ERROR_PERMISSION_DENIED | Permission denied |
int player_set_audio_latency_mode | ( | player_h | player, |
audio_latency_mode_e | latency_mode | ||
) |
Sets the audio latency mode.
[in] | player | The handle to the media player |
[in] | latency_mode | The latency mode to be applied to the audio |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_set_buffering_cb | ( | player_h | player, |
player_buffering_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when there is a change in the buffering status of a media stream.
[in] | player | The handle to the media player |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE | Unsupported feature |
int player_set_completed_cb | ( | player_h | player, |
player_completed_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when the playback is finished.
[in] | player | The handle to the media player |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_set_display | ( | player_h | player, |
player_display_type_e | type, | ||
player_display_h | display | ||
) |
Sets the video display.
[in] | player | The handle to the media player |
[in] | type | The display type |
[in] | display | The handle to display |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_set_error_cb | ( | player_h | player, |
player_error_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when an error occurs.
[in] | player | The handle to the media player |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_set_interrupted_cb | ( | player_h | player, |
player_interrupted_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when the playback is interrupted or the interrupt is completed.
[in] | player | The handle to the media player |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_set_looping | ( | player_h | player, |
bool | looping | ||
) |
Sets the player's looping status.
If the looping status is true
, playback automatically restarts upon finishing. If it is false
, it won't. The default value is false
.
[in] | player | The handle to the media player |
[in] | looping | The new looping status: (true = looping, false = non-looping ) |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_set_media_packet_video_frame_decoded_cb | ( | player_h | player, |
player_media_packet_video_decoded_cb | callback, | ||
void * | user_data | ||
) |
Registers a media packet video callback function to be called once per frame.
[in] | player | The handle to the media player |
[in] | callback | The callback function to be registered |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_STATE | Invalid state |
int player_set_memory_buffer | ( | player_h | player, |
const void * | data, | ||
int | size | ||
) |
Sets memory as the data source.
Associates media content, cached in memory, with the player. Unlike the case of player_set_uri(), the media resides in memory. If the function call is successful, subsequent calls to player_prepare() and player_start() will start playing the media.
[in] | player | The handle to the media player |
[in] | data | The memory pointer of media data |
[in] | size | The size of media data |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_set_mute | ( | player_h | player, |
bool | muted | ||
) |
Sets the player's mute status.
If the mute status is true
, no sounds are played. If it is false
, sounds are played at the previously set volume level. Until this function is called, by default the player is not muted.
[in] | player | The handle to the media player |
[in] | muted | The new mute status: (true = mute, false = not muted) |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_set_play_position | ( | player_h | player, |
int | millisecond, | ||
bool | accurate, | ||
player_seek_completed_cb | callback, | ||
void * | user_data | ||
) |
Sets the seek position for playback, asynchronously.
[in] | player | The handle to the media player |
[in] | millisecond | The position in milliseconds from the start to the seek point |
[in] | accurate | If true the selected position is returned, but this might be considerably slow, otherwise false |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_SEEK_FAILED | Seek operation failure |
int player_set_playback_rate | ( | player_h | player, |
float | rate | ||
) |
Sets the playback rate.
The default value is 1.0
.
0
. 0.0
and over 2.0
. [in] | player | The handle to the media player |
[in] | rate | The playback rate (-5.0x ~ 5.0x) |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_set_progressive_download_message_cb | ( | player_h | player, |
player_pd_message_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when progressive download is started or completed.
[in] | player | The handle to the media player |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE | Unsupported feature |
int player_set_progressive_download_path | ( | player_h | player, |
const char * | path | ||
) |
Sets a path to download, progressively.
[in] | player | The handle to the media player |
[in] | path | The absolute path to download |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE | Unsupported feature |
int player_set_sound_type | ( | player_h | player, |
sound_type_e | type | ||
) |
Sets the player's volume type.
[in] | player | The handle to the media player |
[in] | type | The sound type |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
int player_set_streaming_cookie | ( | player_h | player, |
const char * | cookie, | ||
int | size | ||
) |
Sets the cookie for streaming playback.
[in] | player | The handle to the media player |
[in] | cookie | The cookie to set |
[in] | size | The size of the cookie |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_set_streaming_user_agent | ( | player_h | player, |
const char * | user_agent, | ||
int | size | ||
) |
Sets the streaming user agent for playback.
[in] | player | The handle to the media player |
[in] | user_agent | The user agent to set |
[in] | size | The size of the user agent |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_set_uri | ( | player_h | player, |
const char * | uri | ||
) |
Sets the data source (file-path or HTTP URI) to use.
Associates media contents, referred to by the URI, with the player. If the function call is successful, subsequent calls to player_prepare() and player_start() will start playing the media.
[in] | player | The handle to the media player |
[in] | uri | The content location, such as the file path or HTTP URI |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_set_volume | ( | player_h | player, |
float | left, | ||
float | right | ||
) |
Sets the player's volume.
Setting this volume adjusts the player's instance volume, not the system volume. The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0. To change system volume, use the Sound Manager API. Finally, it does not support to set other value into each channel currently.
[in] | player | The handle to the media player |
[in] | left | The left volume scalar |
[in] | right | The right volume scalar |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_start | ( | player_h | player | ) |
Starts or resumes playback.
Plays current media content, or resumes play if paused.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
PLAYER_ERROR_CONNECTION_FAILED | Network connection failed |
PLAYER_ERROR_SOUND_POLICY | Sound policy error |
int player_stop | ( | player_h | player | ) |
Stops playing media content.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid state |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
PLAYER_ERROR_SOUND_POLICY | Sound policy error |
int player_unprepare | ( | player_h | player | ) |
Resets the media player.
The most recently used media is reset and no longer associated with the player. Playback is no longer possible. If you want to use the player again, you will have to set the data URI and call player_prepare() again.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
PLAYER_ERROR_INVALID_STATE | Invalid player state |
int player_unset_buffering_cb | ( | player_h | player | ) |
Unregisters the callback function.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_unset_completed_cb | ( | player_h | player | ) |
Unregisters the callback function.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_unset_error_cb | ( | player_h | player | ) |
Unregisters the callback function.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_unset_interrupted_cb | ( | player_h | player | ) |
Unregisters the callback function.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |
int player_unset_media_packet_video_frame_decoded_cb | ( | player_h | player | ) |
Unregisters the callback function.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
int player_unset_progressive_download_message_cb | ( | player_h | player | ) |
Unregisters the callback function.
[in] | player | The handle to the media player |
0
on success, otherwise a negative error value PLAYER_ERROR_NONE | Successful |
PLAYER_ERROR_INVALID_PARAMETER | Invalid parameter |
PLAYER_ERROR_INVALID_OPERATION | Invalid operation |