Class WebRTC
Definition
- Namespace:
- Tizen.Multimedia.Remoting
- Assembly:
- Tizen.Multimedia.Remoting.dll
Provides the ability to control WebRTC.
public class WebRTC : IDisposable
- Inheritance
-
objectWebRTC
- Implements
-
System.IDisposable
Constructors
View SourceWebRTC()
Initializes a new instance of the WebRTC class.
Declaration
public WebRTC()
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | Thrown when the permission is denied. |
System.NotSupportedException | The required feature is not supported. |
Properties
View SourceBundlePolicy
Gets or sets the bundle policy.
The default bundle policy is MaxBundle.
Declaration
public WebRTCBundlePolicy BundlePolicy { get; set; }
Property Value
Type | Description |
---|---|
WebRTCBundlePolicy | The policy of bundle |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
IceConnectionState
Gets the ICE connection state of the WebRTC.
Declaration
public WebRTCIceConnectionState IceConnectionState { get; }
Property Value
Type | Description |
---|---|
WebRTCIceConnectionState | The current ICE connection state of the WebRTC. |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
IceGatheringState
Gets the Ice gathering state of the WebRTC.
Declaration
public WebRTCIceGatheringState IceGatheringState { get; }
Property Value
Type | Description |
---|---|
WebRTCIceGatheringState | The current Ice gathering state of the WebRTC. |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
IceTransportPolicy
Gets or sets the ICE transport policy.
Declaration
public IceTransportPolicy IceTransportPolicy { get; set; }
Property Value
Type | Description |
---|---|
IceTransportPolicy | The policy of ICE transport |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
PeerConnectionState
Gets the peer connection state of the WebRTC.
Declaration
public WebRTCPeerConnectionState PeerConnectionState { get; }
Property Value
Type | Description |
---|---|
WebRTCPeerConnectionState | The current peer connection state of the WebRTC. |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
SignalingState
Gets the signaling state of the WebRTC.
Declaration
public WebRTCSignalingState SignalingState { get; }
Property Value
Type | Description |
---|---|
WebRTCSignalingState | The current signaling state of the WebRTC. |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
State
Gets the state of the WebRTC.
Declaration
public WebRTCState State { get; }
Property Value
Type | Description |
---|---|
WebRTCState | The current state of the WebRTC. |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
StunServer
Gets or sets the STUN server url.
Declaration
public string StunServer { get; set; }
Property Value
Type | Description |
---|---|
string | The STUN server url |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | STUN server URI is null. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
Methods
View SourceAddIceCandidate(string)
Adds a new ICE candidate from the remote peer over its signaling channel.
Declaration
public void AddIceCandidate(string iceCandidate)
Parameters
Type | Name | Description |
---|---|---|
string | iceCandidate | The ICE candidate. |
Remarks
The WebRTC must be in the Negotiating.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The ICE candidate is empty string. |
System.ArgumentNullException | The ICE candidate is null. |
System.InvalidOperationException | The WebRTC is not in the valid state. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
AddIceCandidates(IEnumerable<string>)
Adds new ICE candidates from the remote peer over its signaling channel.
Declaration
public void AddIceCandidates(IEnumerable<string> iceCandidates)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T><string> | iceCandidates | The ICE candidates. |
Remarks
The WebRTC must be in the Negotiating.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The ICE candidate is empty string. |
System.ArgumentNullException | The ICE candidate is null. |
System.InvalidOperationException | The WebRTC is not in the valid state. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
AddSource(MediaSource)
Adds media source to the current WebRTC.
Declaration
public void AddSource(MediaSource source)
Parameters
Type | Name | Description |
---|---|---|
MediaSource | source | The media sources to add. |
Remarks
This method does not throw state exception anymore(Since API Level 12). It can be called in any state.
Each MediaSource requires different feature or privilege.
MediaCameraSource needs camera feature and privilege.
MediaMicrophoneSource needs microphone feature and recorder privilege.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The media source is null. |
System.InvalidOperationException | An internal error occurs.
|
System.NotSupportedException | The required feature is not supported. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
System.UnauthorizedAccessException | Thrown when the permission is denied. |
See Also
AddSources(params MediaSource[])
Adds media sources from the current WebRTC.
Declaration
public void AddSources(params MediaSource[] sources)
Parameters
Type | Name | Description |
---|---|---|
MediaSource[] | sources | The media sources to add. |
Remarks
This method does not throw state exception anymore(Since API Level 12). It can be called in any state.
Each MediaSource requires different feature or privilege.
MediaCameraSource needs camera feature and privilege.
MediaMicrophoneSource needs microphone feature and recorder privilege.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The media source is null. |
System.InvalidOperationException | An internal error occurs.
|
System.NotSupportedException | The required feature is not supported. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
System.UnauthorizedAccessException | Thrown when the permission is denied. |
See Also
CreateAnswerAsync()
Creates SDP(Session Description Protocol) answer asynchronously with option to an offer received from a remote peer.
Declaration
public Task<string> CreateAnswerAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><string> | The SDP answer. |
Remarks
The WebRTC must be in the Negotiating or Playing(Since API Level 12)
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The WebRTC is not in the valid state. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
See Also
View SourceCreateOfferAsync()
Creates SDP(Session Description Protocol) offer asynchronously to start a new WebRTC connection to a remote peer.
Declaration
public Task<string> CreateOfferAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><string> | The SDP offer. |
Remarks
The WebRTC must be in the Negotiating or Playing(Since API Level 12)
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The WebRTC is not in the valid state. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
See Also
View SourceDispose()
Releases all resources used by the current instance.
Declaration
public void Dispose()
GetLocalDescription()
Gets the session description for a local peer.
Declaration
public string GetLocalDescription()
Returns
Type | Description |
---|---|
string | The local session description string |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
GetRemoteDescription()
Gets the offer or answer session description from the current remote peer.
Declaration
public string GetRemoteDescription()
Returns
Type | Description |
---|---|
string | The remote session description string |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
See Also
View SourceGetStatistics(WebRTCStatisticsCategory)
Retrieves the current statistics information.
Declaration
public ReadOnlyCollection<WebRTC.WebRTCStatistics> GetStatistics(WebRTCStatisticsCategory category)
Parameters
Type | Name | Description |
---|---|---|
WebRTCStatisticsCategory | category | The category of statistics to get. |
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<T><WebRTC.WebRTCStatistics> | The WebRTC statistics informations. |
Remarks
The WebRTC must be in the Negotiating(Since API Level 12) or Playing
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
System.InvalidOperationException | The WebRTC is not in the valid state. |
GetTurnServer()
Retrieves all turn servers.
Declaration
public ReadOnlyCollection<string> GetTurnServer()
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<T><string> | The turn server list. |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | The WebRTC has already been disposed. |
RemoveSource(MediaSource)
Removes media source from the current WebRTC.
Declaration
public void RemoveSource(MediaSource source)
Parameters
Type | Name | Description |
---|---|---|
MediaSource | source | The media source to remove. |
Remarks
This method does not throw state exception anymore(Since API Level 12). It can be called in any state.
If user want to use removed MediaSource again, user should create new instance for it.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The media source is null. |
System.InvalidOperationException | An internal error occurs. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
See Also
RemoveSources(params MediaSource[])
Removes media sources from the current WebRTC.
Declaration
public void RemoveSources(params MediaSource[] sources)
Parameters
Type | Name | Description |
---|---|---|
MediaSource[] | sources | The media source to remove. |
Remarks
This method does not throw state exception anymore(Since API Level 12). It can be called in any state.
If user want to use removed MediaSource again, user should create new instance for it.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The media source is null. |
System.InvalidOperationException | An internal error occurs. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
See Also
SetLocalDescription(string)
Sets the session description for a local peer.
Declaration
public void SetLocalDescription(string description)
Parameters
Type | Name | Description |
---|---|---|
string | description | The local session description. |
Remarks
The WebRTC must be in the Negotiating or Playing(Since API Level 12)
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The description is empty string. |
System.ArgumentNullException | The description is null. |
System.InvalidOperationException | The WebRTC is not in the valid state. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
See Also
View SourceSetRemoteDescription(string)
Sets the offer or answer session description from the current remote peer.
Declaration
public void SetRemoteDescription(string description)
Parameters
Type | Name | Description |
---|---|---|
string | description | The remote session description. |
Remarks
The WebRTC must be in the Negotiating or Playing(Since API Level 12)
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The description is empty string. |
System.ArgumentNullException | The description is null. |
System.InvalidOperationException | The WebRTC is not in the valid state. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
See Also
View SourceSetTurnServer(string)
Sets a turn server for signalling with remote peer which cannot be connected directly.
Declaration
public void SetTurnServer(string turnServer)
Parameters
Type | Name | Description |
---|---|---|
string | turnServer |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The |
System.ObjectDisposedException | The WebRTC has already been disposed. |
SetTurnServers(params string[])
Sets turn servers for signalling with remote peer which cannot be connected directly.
Declaration
public void SetTurnServers(params string[] turnServers)
Parameters
Type | Name | Description |
---|---|---|
string[] | turnServers |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The one of |
System.ObjectDisposedException | The WebRTC has already been disposed. |
Start()
Starts the WebRTC with specific media source.
Declaration
public void Start()
Remarks
The WebRTC must be in the Idle state.
The WebRTC state will be Negotiating state.
The user should check whether State is changed to Negotiating state or not.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The WebRTC is not in the valid state. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
StartAsync()
Starts the WebRTC asynchronously with specific media source.
Declaration
public Task StartAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
The WebRTC must be in the Idle state.
The WebRTC state will be Negotiating state.
This ensures that State is changed to Negotiating state.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The WebRTC is not in the valid state. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
Stop()
Stops the WebRTC.
Declaration
public void Stop()
Remarks
The WebRTC must be in the Negotiating or Playing state.
The WebRTC state will be Idle state.
The user should check whether State is changed to Idle state or not.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The WebRTC is not in the valid state. |
System.ObjectDisposedException | The WebRTC has already been disposed. |
Events
View SourceAudioFrameEncoded
Occurs when each audio frame is ready to render.
Declaration
public event EventHandler<WebRTCFrameEncodedEventArgs> AudioFrameEncoded
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCFrameEncodedEventArgs> |
DataChannel
Occurs when the data channel is created to the connection by the remote peer.
Declaration
public event EventHandler<WebRTCDataChannelEventArgs> DataChannel
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCDataChannelEventArgs> |
ErrorOccurred
Occurs when any error occurs.
Declaration
public event EventHandler<WebRTCErrorOccurredEventArgs> ErrorOccurred
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCErrorOccurredEventArgs> |
IceCandidate
Occurs when the WebRTC needs to send the ICE candidate message to the remote peer.
Declaration
public event EventHandler<WebRTCIceCandidateEventArgs> IceCandidate
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCIceCandidateEventArgs> |
IceConnectionStateChanged
Occurs when the WebRTC ICE connection state is changed.
Declaration
public event EventHandler<WebRTCIceConnectionStateChangedEventArgs> IceConnectionStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCIceConnectionStateChangedEventArgs> |
IceGatheringStateChanged
Occurs when the WebRTC ICE gathering state is changed.
Declaration
public event EventHandler<WebRTCIceGatheringStateChangedEventArgs> IceGatheringStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCIceGatheringStateChangedEventArgs> |
NegotiationNeeded
Occurs when negotiation is needed.
Declaration
public event EventHandler<EventArgs> NegotiationNeeded
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><System.EventArgs> |
PeerConnectionStateChanged
Occurs when the WebRTC peer connection state is changed.
Declaration
public event EventHandler<WebRTCPeerConnectionStateChangedEventArgs> PeerConnectionStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCPeerConnectionStateChangedEventArgs> |
SignalingStateChanged
Occurs when the WebRTC signaling state is changed.
Declaration
public event EventHandler<WebRTCSignalingStateChangedEventArgs> SignalingStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCSignalingStateChangedEventArgs> |
StateChanged
Occurs when WebRTC state is changed.
Declaration
public event EventHandler<WebRTCStateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCStateChangedEventArgs> |
TrackAdded
Occurs when a new track has been added to the WebRTC.
Declaration
public event EventHandler<WebRTCTrackAddedEventArgs> TrackAdded
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCTrackAddedEventArgs> |
VideoFrameEncoded
Occurs when each video frame is ready to render.
Declaration
public event EventHandler<WebRTCFrameEncodedEventArgs> VideoFrameEncoded
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><WebRTCFrameEncodedEventArgs> |