Tizen Native API
8.0
|
The WebRTC API provides functions for real-time audio/video communication between peers. It supports WebRTC as a native API based on GStreamer multimedia framework.
Required Header
#include <webrtc.h>
Overview
The WebRTC API provides functions to communicate with the remote peer using multimedia sources and generic data. The multimedia sources include audio/video stream from microphone, camera or media file. The generic data includes string or byte data.
This API set allows you to:
- add/remove/mute/pause the media source
- create/destroy data channel and send/receive data via the channel
- set display surface to render the received video data
- start/stop the state of the handle
- make negotiation with the remote peer
- query the various states of the handle including session negotiation
- get notified about various changes via callbacks
State Transitions
FUNCTION | PRE-STATE | POST-STATE | SYNC TYPE |
---|---|---|---|
webrtc_create() | NONE | IDLE | SYNC |
webrtc_destroy() | IDLE/NEGOTIATING/PLAYING | NONE | SYNC |
webrtc_start() | IDLE | NEGOTIATING | ASYNC |
webrtc_stop() | NEGOTIATING/PLAYING | IDLE | ASYNC |
webrtc_set_remote_description() | NEGOTIATING | PLAYING* | ASYNC |
webrtc_set_local_description() | NEGOTIATING | PLAYING* | ASYNC |
webrtc_add_ice_candidate() | NEGOTIATING | PLAYING* | ASYNC |
(*) The transition from the NEGOTIATING state to the PLAYING state will be processed after finishing all the negotiation.
Callback(Event) Operations
The callback mechanism is used to notify the application about significant webrtc events.
Foreach Operations
FOREACH | CALLBACK | DESCRIPTION |
---|---|---|
webrtc_foreach_turn_server() | webrtc_turn_server_cb() | It retrieves the added TURN server one by one |
Related Features
This API is related with the following features:
- http://tizen.org/feature/network.wifi
- http://tizen.org/feature/network.telephony
- http://tizen.org/feature/network.ethernet
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | webrtc_set_error_cb (webrtc_h webrtc, webrtc_error_cb callback, void *user_data) |
Sets a callback function to be invoked when an asynchronous operation error occurs. | |
int | webrtc_unset_error_cb (webrtc_h webrtc) |
Unsets the error callback function. | |
int | webrtc_create (webrtc_h *webrtc) |
Creates an instance of WebRTC. | |
int | webrtc_start (webrtc_h webrtc) |
Starts the WebRTC. | |
int | webrtc_stop (webrtc_h webrtc) |
Stops the WebRTC. | |
int | webrtc_destroy (webrtc_h webrtc) |
Destroys the WebRTC. | |
int | webrtc_set_state_changed_cb (webrtc_h webrtc, webrtc_state_changed_cb callback, void *user_data) |
Sets a callback function to be invoked when the WebRTC state is changed. | |
int | webrtc_unset_state_changed_cb (webrtc_h webrtc) |
Unsets the state changed callback function. | |
int | webrtc_get_state (webrtc_h webrtc, webrtc_state_e *state) |
Gets the WebRTC state. | |
int | webrtc_set_stun_server (webrtc_h webrtc, const char *stun_server) |
Sets a STUN server URL. | |
int | webrtc_get_stun_server (webrtc_h webrtc, char **stun_server) |
Gets the STUN server URL. | |
int | webrtc_add_turn_server (webrtc_h webrtc, const char *turn_server) |
Adds a TURN server URL. | |
int | webrtc_foreach_turn_server (webrtc_h webrtc, webrtc_turn_server_cb callback, void *user_data) |
Retrieves all the TURN server URLs. | |
int | webrtc_set_bundle_policy (webrtc_h webrtc, webrtc_bundle_policy_e policy) |
Sets a bundle policy. | |
int | webrtc_get_bundle_policy (webrtc_h webrtc, webrtc_bundle_policy_e *policy) |
Gets the bundle policy. | |
int | webrtc_set_ice_transport_policy (webrtc_h webrtc, webrtc_ice_transport_policy_e policy) |
Sets a ICE transport policy that represents which candidates the ICE Agent is allowed to use. | |
int | webrtc_get_ice_transport_policy (webrtc_h webrtc, webrtc_ice_transport_policy_e *policy) |
Gets the ICE transport policy. | |
int | webrtc_set_peer_connection_state_change_cb (webrtc_h webrtc, webrtc_peer_connection_state_change_cb callback, void *user_data) |
Sets a callback function to be invoked when the WebRTC peer connection state is changed. | |
int | webrtc_unset_peer_connection_state_change_cb (webrtc_h webrtc) |
Unsets the peer connection state change callback function. | |
int | webrtc_get_peer_connection_state (webrtc_h webrtc, webrtc_peer_connection_state_e *state) |
Gets the peer connection state. | |
int | webrtc_set_signaling_state_change_cb (webrtc_h webrtc, webrtc_signaling_state_change_cb callback, void *user_data) |
Sets a callback function to be invoked when the WebRTC signaling state is changed. | |
int | webrtc_unset_signaling_state_change_cb (webrtc_h webrtc) |
Unsets the signaling state change callback function. | |
int | webrtc_get_signaling_state (webrtc_h webrtc, webrtc_signaling_state_e *state) |
Gets the signaling state. | |
int | webrtc_set_ice_gathering_state_change_cb (webrtc_h webrtc, webrtc_ice_gathering_state_change_cb callback, void *user_data) |
Sets a callback function to be invoked when the WebRTC ICE gathering state is changed. | |
int | webrtc_unset_ice_gathering_state_change_cb (webrtc_h webrtc) |
Unsets the ICE gathering state change callback function. | |
int | webrtc_get_ice_gathering_state (webrtc_h webrtc, webrtc_ice_gathering_state_e *state) |
Gets the ICE gathering state. | |
int | webrtc_set_ice_connection_state_change_cb (webrtc_h webrtc, webrtc_ice_connection_state_change_cb callback, void *user_data) |
Sets a callback function to be invoked when the WebRTC ICE connection state is changed. | |
int | webrtc_unset_ice_connection_state_change_cb (webrtc_h webrtc) |
Unsets the ICE connection state change callback function. | |
int | webrtc_get_ice_connection_state (webrtc_h webrtc, webrtc_ice_connection_state_e *state) |
Gets the ICE connection state. | |
int | webrtc_set_negotiation_needed_cb (webrtc_h webrtc, webrtc_negotiation_needed_cb callback, void *user_data) |
Sets a negotiation needed callback function to be invoked when a change has occurred which requires session negotiation. | |
int | webrtc_unset_negotiation_needed_cb (webrtc_h webrtc) |
Unsets the negotiation needed callback function. | |
int | webrtc_set_ice_candidate_cb (webrtc_h webrtc, webrtc_ice_candidate_cb callback, void *user_data) |
Sets an ICE candidate callback function to be invoked when the WebRTC needs to send the ICE candidate message to the remote peer. | |
int | webrtc_unset_ice_candidate_cb (webrtc_h webrtc) |
Unsets the ice candidate callback function. | |
int | webrtc_create_offer (webrtc_h webrtc, bundle *options, char **offer) |
Creates SDP offer to start a new WebRTC connection to a remote peer. | |
int | webrtc_create_answer (webrtc_h webrtc, bundle *options, char **answer) |
Creates SDP answer to an offer received from a remote peer during the negotiation of a WebRTC connection. | |
int | webrtc_create_offer_async (webrtc_h webrtc, bundle *options, webrtc_session_description_created_cb callback, void *user_data) |
Creates SDP offer asynchronously to start a new WebRTC connection to a remote peer. | |
int | webrtc_create_answer_async (webrtc_h webrtc, bundle *options, webrtc_session_description_created_cb callback, void *user_data) |
Creates SDP answer asynchronously to an offer received from a remote peer during the negotiation of a WebRTC connection. | |
int | webrtc_set_local_description (webrtc_h webrtc, const char *description) |
Sets the session description for a local peer associated with a WebRTC connection. | |
int | webrtc_set_remote_description (webrtc_h webrtc, const char *description) |
Sets the session description of the remote peer's current offer or answer. | |
int | webrtc_add_ice_candidate (webrtc_h webrtc, const char *candidate) |
Adds a new ICE candidate from the remote peer over its signaling channel. | |
int | webrtc_set_track_added_cb (webrtc_h webrtc, webrtc_track_added_cb callback, void *user_data) |
Sets a track added callback function to be invoked when a new track has been added to the WebRTC. | |
int | webrtc_unset_track_added_cb (webrtc_h webrtc) |
Unsets the track added callback function. | |
Typedefs | |
typedef void * | webrtc_h |
WebRTC handle type. | |
typedef void(* | webrtc_error_cb )(webrtc_h webrtc, webrtc_error_e error, webrtc_state_e state, void *user_data) |
Called when an error occurs. | |
typedef void(* | webrtc_state_changed_cb )(webrtc_h webrtc, webrtc_state_e previous, webrtc_state_e current, void *user_data) |
Called when the WebRTC state is changed. | |
typedef void(* | webrtc_session_description_created_cb )(webrtc_h webrtc, const char *description, void *user_data) |
Called when the session description is created. | |
typedef void(* | webrtc_peer_connection_state_change_cb )(webrtc_h webrtc, webrtc_peer_connection_state_e state, void *user_data) |
Called when the WebRTC peer connection state is changed. | |
typedef void(* | webrtc_signaling_state_change_cb )(webrtc_h webrtc, webrtc_signaling_state_e state, void *user_data) |
Called when the WebRTC signaling state is changed. | |
typedef void(* | webrtc_ice_gathering_state_change_cb )(webrtc_h webrtc, webrtc_ice_gathering_state_e state, void *user_data) |
Called when the WebRTC ICE gathering state is changed. | |
typedef void(* | webrtc_ice_connection_state_change_cb )(webrtc_h webrtc, webrtc_ice_connection_state_e state, void *user_data) |
Called when the WebRTC ICE connection state is changed. | |
typedef bool(* | webrtc_turn_server_cb )(const char *turn_server, void *user_data) |
Called iteratively to report all the TURN server URLs. | |
typedef void(* | webrtc_negotiation_needed_cb )(webrtc_h webrtc, void *user_data) |
Called when the WebRTC needs session negotiation. | |
typedef void(* | webrtc_ice_candidate_cb )(webrtc_h webrtc, const char *candidate, void *user_data) |
Called when the WebRTC needs to send the ICE candidate message to the remote peer through the signaling channel. | |
typedef void(* | webrtc_track_added_cb )(webrtc_h webrtc, webrtc_media_type_e type, unsigned int track_id, void *user_data) |
Called when a new track has been added to the WebRTC pipeline after the negotiation. |
Typedef Documentation
typedef void(* webrtc_error_cb)(webrtc_h webrtc, webrtc_error_e error, webrtc_state_e state, void *user_data) |
Called when an error occurs.
The following error codes can be received:
WEBRTC_ERROR_INVALID_OPERATION
WEBRTC_ERROR_CONNECTION_FAILED
WEBRTC_ERROR_STREAM_FAILED
WEBRTC_ERROR_RESOURCE_FAILED
WEBRTC_ERROR_RESOURCE_CONFLICT
WEBRTC_ERROR_NETWORK_RESOURCE_FAILED (Since 8.0)
- Since :
- 6.5
- Remarks:
- The webrtc is the same object for which the callback was set.
The webrtc should not be released.
- Parameters:
-
[in] webrtc WebRTC handle [in] error The error code [in] state The current state of the WebRTC handle [in] user_data The user data passed from the callback registration function
typedef void* webrtc_h |
WebRTC handle type.
- Since :
- 6.5
typedef void(* webrtc_ice_candidate_cb)(webrtc_h webrtc, const char *candidate, void *user_data) |
Called when the WebRTC needs to send the ICE candidate message to the remote peer through the signaling channel.
- Since :
- 6.5
- Remarks:
- The webrtc is the same object for which the callback was set.
The webrtc should not be released.
The candidate can be used only in the callback. To use outside, make a copy.
It will be {"ice":{"candidate":"...", "sdpMLineIndex":0 or 1 or ...}}.
- Parameters:
-
[in] webrtc WebRTC handle [in] candidate The ICE candidate message [in] user_data The user data passed from the callback registration function
- Postcondition:
- candidate must be sent to the remote peer via the signaling channel.
typedef void(* webrtc_ice_connection_state_change_cb)(webrtc_h webrtc, webrtc_ice_connection_state_e state, void *user_data) |
Called when the WebRTC ICE connection state is changed.
- Since :
- 6.5
- Remarks:
- The webrtc is the same object for which the callback was set.
The webrtc should not be released.
- Parameters:
-
[in] webrtc WebRTC handle [in] state The ICE connection state [in] user_data The user data passed from the callback registration function
typedef void(* webrtc_ice_gathering_state_change_cb)(webrtc_h webrtc, webrtc_ice_gathering_state_e state, void *user_data) |
Called when the WebRTC ICE gathering state is changed.
- Since :
- 6.5
- Remarks:
- The webrtc is the same object for which the callback was set.
The webrtc should not be released.
- Parameters:
-
[in] webrtc WebRTC handle [in] state The ICE gathering state [in] user_data The user data passed from the callback registration function
typedef void(* webrtc_negotiation_needed_cb)(webrtc_h webrtc, void *user_data) |
Called when the WebRTC needs session negotiation.
- Since :
- 6.5
- Remarks:
- The webrtc is the same object for which the callback was set.
The webrtc should not be released.
- Parameters:
-
[in] webrtc WebRTC handle [in] user_data The user data passed from the callback registration function
typedef void(* webrtc_peer_connection_state_change_cb)(webrtc_h webrtc, webrtc_peer_connection_state_e state, void *user_data) |
Called when the WebRTC peer connection state is changed.
- Since :
- 6.5
- Remarks:
- The webrtc is the same object for which the callback was set.
The webrtc should not be released.
- Parameters:
-
[in] webrtc WebRTC handle [in] state The peer connection state [in] user_data The user data passed from the callback registration function
typedef void(* webrtc_session_description_created_cb)(webrtc_h webrtc, const char *description, void *user_data) |
Called when the session description is created.
- Since :
- 6.5
- Remarks:
- The webrtc is the same object for which the callback was set.
The webrtc should not be released.
description is a JSON string.
It will be {"sdp":{"type":"offer or answer","sdp":"..."}}.
The description can be used only in the callback. To use outside, make a copy.
- Parameters:
-
[in] webrtc WebRTC handle [in] description The session description [in] user_data The user data passed from the callback registration function
- Postcondition:
- description must be set as a local description by calling webrtc_set_local_description()
- description must be sent to the remote peer via the signaling channel.
typedef void(* webrtc_signaling_state_change_cb)(webrtc_h webrtc, webrtc_signaling_state_e state, void *user_data) |
Called when the WebRTC signaling state is changed.
- Since :
- 6.5
- Remarks:
- The webrtc is the same object for which the callback was set.
The webrtc should not be released.
- Parameters:
-
[in] webrtc WebRTC handle [in] state The signaling state [in] user_data The user data passed from the callback registration function
typedef void(* webrtc_state_changed_cb)(webrtc_h webrtc, webrtc_state_e previous, webrtc_state_e current, void *user_data) |
Called when the WebRTC state is changed.
- Since :
- 6.5
- Remarks:
- The webrtc is the same object for which the callback was set.
The webrtc should not be released.
- Parameters:
-
[in] webrtc WebRTC handle [in] previous The previous state of the WebRTC handle [in] current The current state of the WebRTC handle [in] user_data The user data passed from the callback registration function
typedef void(* webrtc_track_added_cb)(webrtc_h webrtc, webrtc_media_type_e type, unsigned int track_id, void *user_data) |
Called when a new track has been added to the WebRTC pipeline after the negotiation.
- Since :
- 6.5
- Remarks:
- The webrtc is the same object for which the callback was set.
The webrtc should not be released.
- Parameters:
-
[in] webrtc WebRTC handle [in] type The media type [in] track_id The track id [in] user_data The user data passed from the callback registration function
typedef bool(* webrtc_turn_server_cb)(const char *turn_server, void *user_data) |
Called iteratively to report all the TURN server URLs.
- Since :
- 6.5
- Remarks:
- The turn_server can be used only in the callback. To use outside, make a copy.
- Parameters:
-
[in] turn_server The TURN server URL [in] user_data The user data passed from the callback registration function
- Returns:
true
to continue with the next iteration of the loop, otherwisefalse
to break out of the loop
- See also:
- webrtc_foreach_turn_server()
Enumeration Type Documentation
Enumeration for WebRTC bundle policy.
- Since :
- 7.0
- Remarks:
- It corresponds with the RTCBundlePolicy enum described in https://www.w3.org/TR/webrtc/#rtcbundlepolicy-enum.
enum webrtc_error_e |
Enumeration for WebRTC error.
- Since :
- 6.5
- Enumerator:
Enumeration for WebRTC ICE connection state.
- Since :
- 6.5
- Remarks:
- It corresponds with the RTCIceConnectionState enum described in https://www.w3.org/TR/webrtc/#rtciceconnectionstate-enum.
- Enumerator:
Enumeration for WebRTC ICE gathering state.
- Since :
- 6.5
- Remarks:
- It corresponds with the RTCIceGatheringState enum described in https://www.w3.org/TR/webrtc/#rtcicegatheringstate-enum.
Enumeration for WebRTC ICE transport policy.
- Since :
- 6.5
- Remarks:
- It corresponds with the RTCIceTransportPolicy enum described in https://www.w3.org/TR/webrtc/#rtcicetransportpolicy-enum.
enum webrtc_media_type_e |
Enumeration for WebRTC peer connection state.
- Since :
- 6.5
- Remarks:
- It corresponds with the RTCPeerConnectionState enum described in https://www.w3.org/TR/webrtc/#rtcpeerconnectionstate-enum.
Enumeration for WebRTC signaling state.
- Since :
- 6.5
- Remarks:
- It corresponds with the RTCSignalingState enum described in https://www.w3.org/TR/webrtc/#rtcsignalingstate-enum.
- Enumerator:
enum webrtc_state_e |
Function Documentation
int webrtc_add_ice_candidate | ( | webrtc_h | webrtc, |
const char * | candidate | ||
) |
Adds a new ICE candidate from the remote peer over its signaling channel.
- Since :
- 6.5
- Remarks:
- candidate is a JSON string.
It should be {"ice":{"candidate":"...", "sdpMLineIndex":0 or 1 or ...}}.
- Parameters:
-
[in] webrtc WebRTC handle [in] candidate The ICE candidate
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_NEGOTIATING.
int webrtc_add_turn_server | ( | webrtc_h | webrtc, |
const char * | turn_server | ||
) |
Adds a TURN server URL.
- Since :
- 6.5
- Remarks:
- Regarding TURN, refer to the RFC7065(https://tools.ietf.org/html/rfc7065).
- Parameters:
-
[in] webrtc WebRTC handle [in] turn_server The TURN server URL of the form turn(s)://username:password@host:port
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- See also:
- webrtc_foreach_turn_server()
int webrtc_create | ( | webrtc_h * | webrtc | ) |
Creates an instance of WebRTC.
- Since :
- 6.5
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/internet
- Remarks:
- A signaling channel not addressed in this API should be established to send SDP or ICE candidate messages to each other.
The webrtc should be released using webrtc_destroy().
- Parameters:
-
[out] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_NOT_SUPPORTED Not supported WEBRTC_ERROR_PERMISSION_DENIED Permission denied WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Postcondition:
- webrtc state will be WEBRTC_STATE_IDLE.
- See also:
- webrtc_destroy()
int webrtc_create_answer | ( | webrtc_h | webrtc, |
bundle * | options, | ||
char ** | answer | ||
) |
Creates SDP answer to an offer received from a remote peer during the negotiation of a WebRTC connection.
- Since :
- 6.5
- Remarks:
- The answer should be released using free().
The options currently has no effect.
- Parameters:
-
[in] webrtc WebRTC handle [in] options Configuration options for the answer (optional, this can be NULL) [out] answer SDP answer
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_NEGOTIATING.
- The remote SDP offer must be set by calling webrtc_set_remote_description().
- The signaling state must be set to WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER.
- Postcondition:
- answer must be set as a local description by calling webrtc_set_local_description()
- answer must be sent to the remote peer via the signaling channel.
int webrtc_create_answer_async | ( | webrtc_h | webrtc, |
bundle * | options, | ||
webrtc_session_description_created_cb | callback, | ||
void * | user_data | ||
) |
Creates SDP answer asynchronously to an offer received from a remote peer during the negotiation of a WebRTC connection.
- Since :
- 6.5
- Remarks:
- The registered callback will be invoked in the main thread.
The options currently has no effect.
- Parameters:
-
[in] webrtc WebRTC handle [in] options Configuration options for the answer (optional, this can be NULL) [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_NEGOTIATING.
- The remote SDP offer must be set by calling webrtc_set_remote_description().
- The signaling state must be set to WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER.
- Postcondition:
- webrtc_session_description_created_cb() will be invoked.
int webrtc_create_offer | ( | webrtc_h | webrtc, |
bundle * | options, | ||
char ** | offer | ||
) |
Creates SDP offer to start a new WebRTC connection to a remote peer.
- Since :
- 6.5
- Remarks:
- The offer should be released using free().
The options currently has no effect.
- Parameters:
-
[in] webrtc WebRTC handle [in] options Configuration options for the offer (optional, this can be NULL) [out] offer SDP offer
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_NEGOTIATING.
- Postcondition:
- offer must be set as a local description by calling webrtc_set_local_description()
- offer must be sent to the remote peer via the signaling channel.
int webrtc_create_offer_async | ( | webrtc_h | webrtc, |
bundle * | options, | ||
webrtc_session_description_created_cb | callback, | ||
void * | user_data | ||
) |
Creates SDP offer asynchronously to start a new WebRTC connection to a remote peer.
- Since :
- 6.5
- Remarks:
- The registered callback will be invoked in the main thread.
The options currently has no effect.
- Parameters:
-
[in] webrtc WebRTC handle [in] options Configuration options for the offer (optional, this can be NULL) [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_NEGOTIATING.
- Postcondition:
- webrtc_session_description_created_cb() will be invoked.
int webrtc_destroy | ( | webrtc_h | webrtc | ) |
Destroys the WebRTC.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- See also:
- webrtc_create()
int webrtc_foreach_turn_server | ( | webrtc_h | webrtc, |
webrtc_turn_server_cb | callback, | ||
void * | user_data | ||
) |
Retrieves all the TURN server URLs.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
int webrtc_get_bundle_policy | ( | webrtc_h | webrtc, |
webrtc_bundle_policy_e * | policy | ||
) |
Gets the bundle policy.
- Since :
- 7.0
- Remarks:
- The default value is WEBRTC_BUNDLE_POLICY_MAX_BUNDLE.
- Parameters:
-
[in] webrtc WebRTC handle [out] policy The bundle policy
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- webrtc_set_bundle_policy()
int webrtc_get_ice_connection_state | ( | webrtc_h | webrtc, |
webrtc_ice_connection_state_e * | state | ||
) |
Gets the ICE connection state.
- Since :
- 6.5
- Remarks:
- The default value is WEBRTC_ICE_CONNECTION_STATE_NEW.
- Parameters:
-
[in] webrtc WebRTC handle [out] state The ICE connection state
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
int webrtc_get_ice_gathering_state | ( | webrtc_h | webrtc, |
webrtc_ice_gathering_state_e * | state | ||
) |
Gets the ICE gathering state.
- Since :
- 6.5
- Remarks:
- The default value is WEBRTC_ICE_GATHERING_STATE_NEW.
- Parameters:
-
[in] webrtc WebRTC handle [out] state The ICE gathering state
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
int webrtc_get_ice_transport_policy | ( | webrtc_h | webrtc, |
webrtc_ice_transport_policy_e * | policy | ||
) |
Gets the ICE transport policy.
- Since :
- 6.5
- Remarks:
- The default value is WEBRTC_ICE_TRANSPORT_POLICY_ALL.
- Parameters:
-
[in] webrtc WebRTC handle [out] policy The ICE transport policy
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- webrtc_set_ice_transport_policy()
int webrtc_get_peer_connection_state | ( | webrtc_h | webrtc, |
webrtc_peer_connection_state_e * | state | ||
) |
Gets the peer connection state.
- Since :
- 6.5
- Remarks:
- The default value is WEBRTC_PEER_CONNECTION_STATE_NEW.
- Parameters:
-
[in] webrtc WebRTC handle [out] state The peer connection state
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
int webrtc_get_signaling_state | ( | webrtc_h | webrtc, |
webrtc_signaling_state_e * | state | ||
) |
Gets the signaling state.
- Since :
- 6.5
- Remarks:
- The default value is WEBRTC_SIGNALING_STATE_STABLE.
- Parameters:
-
[in] webrtc WebRTC handle [out] state The signaling state
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
int webrtc_get_state | ( | webrtc_h | webrtc, |
webrtc_state_e * | state | ||
) |
Gets the WebRTC state.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle [out] state WebRTC state
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
int webrtc_get_stun_server | ( | webrtc_h | webrtc, |
char ** | stun_server | ||
) |
Gets the STUN server URL.
- Since :
- 6.5
- Remarks:
- The stun_server should be released using free().
- Parameters:
-
[in] webrtc WebRTC handle [out] stun_server The STUN server URL
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
int webrtc_set_bundle_policy | ( | webrtc_h | webrtc, |
webrtc_bundle_policy_e | policy | ||
) |
Sets a bundle policy.
- Since :
- 7.0
- Parameters:
-
[in] webrtc WebRTC handle [in] policy The bundle policy
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- See also:
- webrtc_get_bundle_policy()
int webrtc_set_error_cb | ( | webrtc_h | webrtc, |
webrtc_error_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to be invoked when an asynchronous operation error occurs.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- Postcondition:
- webrtc_error_cb() will be invoked.
- See also:
- webrtc_unset_error_cb()
- webrtc_error_cb()
int webrtc_set_ice_candidate_cb | ( | webrtc_h | webrtc, |
webrtc_ice_candidate_cb | callback, | ||
void * | user_data | ||
) |
Sets an ICE candidate callback function to be invoked when the WebRTC needs to send the ICE candidate message to the remote peer.
- Since :
- 6.5
- Remarks:
- If all the ICE candidates have been gathered, ICE gathering state will be changed to WEBRTC_ICE_GATHERING_STATE_COMPLETE.
The registered callback will be invoked in an internal thread of the webrtc.
- Parameters:
-
[in] webrtc WebRTC handle [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- Postcondition:
- webrtc_ice_candidate_cb() will be invoked.
int webrtc_set_ice_connection_state_change_cb | ( | webrtc_h | webrtc, |
webrtc_ice_connection_state_change_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to be invoked when the WebRTC ICE connection state is changed.
- Since :
- 6.5
- Remarks:
- The registered callback will be invoked in the main thread.
- Parameters:
-
[in] webrtc WebRTC handle [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- Postcondition:
- webrtc_ice_connection_state_change_cb() will be invoked.
int webrtc_set_ice_gathering_state_change_cb | ( | webrtc_h | webrtc, |
webrtc_ice_gathering_state_change_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to be invoked when the WebRTC ICE gathering state is changed.
- Since :
- 6.5
- Remarks:
- The registered callback will be invoked in the main thread.
- Parameters:
-
[in] webrtc WebRTC handle [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- Postcondition:
- webrtc_ice_gathering_state_change_cb() will be invoked.
int webrtc_set_ice_transport_policy | ( | webrtc_h | webrtc, |
webrtc_ice_transport_policy_e | policy | ||
) |
Sets a ICE transport policy that represents which candidates the ICE Agent is allowed to use.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle [in] policy The ICE transport policy
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- See also:
- webrtc_get_ice_transport_policy()
int webrtc_set_local_description | ( | webrtc_h | webrtc, |
const char * | description | ||
) |
Sets the session description for a local peer associated with a WebRTC connection.
- Since :
- 6.5
- Remarks:
- description is a JSON string.
It will be {"sdp":{"type":"offer or answer","sdp":"..."}}.
- Parameters:
-
[in] webrtc WebRTC handle [in] description The local session description
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_NEGOTIATING.
int webrtc_set_negotiation_needed_cb | ( | webrtc_h | webrtc, |
webrtc_negotiation_needed_cb | callback, | ||
void * | user_data | ||
) |
Sets a negotiation needed callback function to be invoked when a change has occurred which requires session negotiation.
- Since :
- 6.5
- Remarks:
- The registered callback will be invoked in an internal thread of the webrtc.
- Parameters:
-
[in] webrtc WebRTC handle [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- Postcondition:
- webrtc_negotiation_needed_cb() will be invoked.
int webrtc_set_peer_connection_state_change_cb | ( | webrtc_h | webrtc, |
webrtc_peer_connection_state_change_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to be invoked when the WebRTC peer connection state is changed.
- Since :
- 6.5
- Remarks:
- The registered callback will be invoked in the main thread.
- Parameters:
-
[in] webrtc WebRTC handle [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- Postcondition:
- webrtc_peer_connection_state_change_cb() will be invoked.
int webrtc_set_remote_description | ( | webrtc_h | webrtc, |
const char * | description | ||
) |
Sets the session description of the remote peer's current offer or answer.
- Since :
- 6.5
- Remarks:
- description is a JSON string.
It should be {"sdp":{"type":"offer or answer","sdp":"..."}}.
- Parameters:
-
[in] webrtc WebRTC handle [in] description The remote session description
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_NEGOTIATING.
int webrtc_set_signaling_state_change_cb | ( | webrtc_h | webrtc, |
webrtc_signaling_state_change_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to be invoked when the WebRTC signaling state is changed.
- Since :
- 6.5
- Remarks:
- The registered callback will be invoked in the main thread.
- Parameters:
-
[in] webrtc WebRTC handle [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- Postcondition:
- webrtc_signaling_state_change_cb() will be invoked.
int webrtc_set_state_changed_cb | ( | webrtc_h | webrtc, |
webrtc_state_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to be invoked when the WebRTC state is changed.
- Since :
- 6.5
- Remarks:
- The registered callback will be invoked in the main thread.
- Parameters:
-
[in] webrtc WebRTC handle [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- Postcondition:
- webrtc_state_changed_cb() will be invoked.
int webrtc_set_stun_server | ( | webrtc_h | webrtc, |
const char * | stun_server | ||
) |
Sets a STUN server URL.
- Since :
- 6.5
- Remarks:
- Regarding STUN, refer to the RFC7064(https://tools.ietf.org/html/rfc7064).
- Parameters:
-
[in] webrtc WebRTC handle [in] stun_server The STUN server URL of the form stun://host:port
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_set_track_added_cb | ( | webrtc_h | webrtc, |
webrtc_track_added_cb | callback, | ||
void * | user_data | ||
) |
Sets a track added callback function to be invoked when a new track has been added to the WebRTC.
- Since :
- 6.5
- Remarks:
- The registered callback will be invoked in an internal thread of the webrtc.
- Parameters:
-
[in] webrtc WebRTC handle [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE or WEBRTC_STATE_NEGOTIATING.
- Postcondition:
- webrtc_track_added_cb() will be invoked.
int webrtc_start | ( | webrtc_h | webrtc | ) |
Starts the WebRTC.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state WEBRTC_ERROR_RESOURCE_FAILED Resource failed
- Precondition:
- webrtc_ice_candidate_cb() must be set by calling webrtc_set_ice_candidate_cb().
- webrtc_media_packet_source_set_format() must be called if webrtc has a media packet source.
- webrtc state must be set to WEBRTC_STATE_IDLE.
- Postcondition:
- webrtc state will be WEBRTC_STATE_NEGOTIATING.
- See also:
- webrtc_create()
- webrtc_stop()
int webrtc_stop | ( | webrtc_h | webrtc | ) |
Stops the WebRTC.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_STATE Invalid state WEBRTC_ERROR_RESOURCE_FAILED Resource failed
- Precondition:
- webrtc state must be set to WEBRTC_STATE_NEGOTIATING or WEBRTC_STATE_PLAYING.
- Postcondition:
- webrtc state will be WEBRTC_STATE_IDLE.
- See also:
- webrtc_create()
- webrtc_start()
int webrtc_unset_error_cb | ( | webrtc_h | webrtc | ) |
Unsets the error callback function.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- See also:
- webrtc_set_error_cb()
int webrtc_unset_ice_candidate_cb | ( | webrtc_h | webrtc | ) |
Unsets the ice candidate callback function.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- See also:
- webrtc_set_ice_candidate_cb()
int webrtc_unset_ice_connection_state_change_cb | ( | webrtc_h | webrtc | ) |
Unsets the ICE connection state change callback function.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_unset_ice_gathering_state_change_cb | ( | webrtc_h | webrtc | ) |
Unsets the ICE gathering state change callback function.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_unset_negotiation_needed_cb | ( | webrtc_h | webrtc | ) |
Unsets the negotiation needed callback function.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- See also:
- webrtc_set_negotiation_needed_cb()
int webrtc_unset_peer_connection_state_change_cb | ( | webrtc_h | webrtc | ) |
Unsets the peer connection state change callback function.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_unset_signaling_state_change_cb | ( | webrtc_h | webrtc | ) |
Unsets the signaling state change callback function.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_unset_state_changed_cb | ( | webrtc_h | webrtc | ) |
Unsets the state changed callback function.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- See also:
- webrtc_set_state_changed_cb()
int webrtc_unset_track_added_cb | ( | webrtc_h | webrtc | ) |
Unsets the track added callback function.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- See also:
- webrtc_set_track_added_cb()