Tizen Native API
5.0
|
The Streaming API provides functions for streaming playback and buffering controlling.
#include <player.h>
The streaming API allows you to set and get various properties to setup network connection and control buffering scheme:
Functions | |
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_buffering_cb (player_h player, player_buffering_cb callback, void *user_data) |
Sets 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) |
Unsets the buffering callback function. | |
int | player_set_progressive_download_path (player_h player, const char *path) TIZEN_DEPRECATED_API |
Sets a path to download, progressively. | |
int | player_get_progressive_download_status (player_h player, unsigned long *current, unsigned long *total_size) TIZEN_DEPRECATED_API |
Gets the status of progressive download. | |
int | player_set_progressive_download_message_cb (player_h player, player_pd_message_cb callback, void *user_data) TIZEN_DEPRECATED_API |
Sets a callback function to be invoked when progressive download is started or completed. | |
int | player_unset_progressive_download_message_cb (player_h player) TIZEN_DEPRECATED_API |
Unsets the progressive download message callback function. | |
int | player_foreach_adaptive_variant (player_h player, player_adaptive_variant_cb callback, void *user_data) |
Retrieves all the streaming variant information. | |
int | player_set_max_adaptive_variant_limit (player_h player, int bandwidth, int width, int height) |
Sets the maximum limit of the streaming variant. | |
int | player_get_max_adaptive_variant_limit (player_h player, int *bandwidth, int *width, int *height) |
Gets the maximum limit of the streaming variant. | |
int | player_set_streaming_buffering_time (player_h player, int prebuffer_ms, int rebuffer_ms) |
Sets the streaming buffering time. | |
int | player_get_streaming_buffering_time (player_h player, int *prebuffer_ms, int *rebuffer_ms) |
Gets the streaming buffering time. | |
Typedefs | |
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_adaptive_variant_cb )(int bandwidth, int width, int height, void *user_data) |
Called to notify the streaming variant information. |
typedef void(* player_adaptive_variant_cb)(int bandwidth, int width, int height, void *user_data) |
Called to notify the streaming variant information.
The adaptive streaming protocol(hls, mpeg dash) can support variant stream condition. All the streaming variant information can be shared by calling player_foreach_adaptive_variant().
[in] | bandwidth | The bandwidth of the stream can be supportable, this is mandatory parameter |
[in] | width | The width of the stream, this is optional parameter |
[in] | height | The height of the stream, this is optional parameter |
[in] | user_data | The user data passed from the callback registration function |
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_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 |
int player_foreach_adaptive_variant | ( | player_h | player, |
player_adaptive_variant_cb | callback, | ||
void * | user_data | ||
) |
Retrieves all the streaming variant information.
[in] | player | The handle to the media player |
[in] | callback | The iteration callback function |
[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_INVALID_STATE | Invalid player state |
int player_get_max_adaptive_variant_limit | ( | player_h | player, |
int * | bandwidth, | ||
int * | width, | ||
int * | height | ||
) |
Gets the maximum limit of the streaming variant.
[in] | player | The handle to the media player |
[out] | bandwidth | The max bandwidth limit of the stream variant (default: -1) |
[out] | width | The max width limit of the stream variant (default: -1) |
[out] | height | The max height limit of the stream variant (default: -1) |
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_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_streaming_buffering_time | ( | player_h | player, |
int * | prebuffer_ms, | ||
int * | rebuffer_ms | ||
) |
Gets the streaming buffering time.
[in] | player | The handle to the media player |
[out] | prebuffer_ms | The time duration of buffering data that must be prerolled to start playback. |
[out] | rebuffer_ms | The time duration of buffering data that must be prerolled to resume playback if player enters pause state for buffering. |
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_set_buffering_cb | ( | player_h | player, |
player_buffering_cb | callback, | ||
void * | user_data | ||
) |
Sets 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 |
int player_set_max_adaptive_variant_limit | ( | player_h | player, |
int | bandwidth, | ||
int | width, | ||
int | height | ||
) |
Sets the maximum limit of the streaming variant.
[in] | player | The handle to the media player |
[in] | bandwidth | The max bandwidth limit of the stream variant (default: -1) |
[in] | width | The max width limit of the stream variant (default: -1) |
[in] | height | The max height limit of the stream variant (default: -1) |
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_progressive_download_message_cb | ( | player_h | player, |
player_pd_message_cb | callback, | ||
void * | user_data | ||
) |
Sets 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 |
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_PERMISSION_DENIED | Permission denied |
int player_set_streaming_buffering_time | ( | player_h | player, |
int | prebuffer_ms, | ||
int | rebuffer_ms | ||
) |
Sets the streaming buffering time.
[in] | player | The handle to the media player |
[in] | prebuffer_ms | The time duration of buffering data that must be prerolled to start playback. |
[in] | rebuffer_ms | The time duration of buffering data that must be prerolled to resume playback if player is paused for buffering internally. |
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_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_unset_buffering_cb | ( | player_h | player | ) |
Unsets the buffering 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_progressive_download_message_cb | ( | player_h | player | ) |
Unsets the progressive download message 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 |