Class WebRTC

Definition

Namespace:
Tizen.Multimedia.Remoting
Assembly:
Tizen.Multimedia.Remoting.dll
API Level:
9

Provides the ability to control WebRTC.

C#
Copy
public class WebRTC : IDisposable
Inheritance
System.Object
WebRTC
Implements
System.IDisposable

Constructors

View Source

WebRTC()

Initializes a new instance of the WebRTC class.

Declaration
C#
Copy
public WebRTC()
Exceptions
Type Condition
UnauthorizedAccessException

Thrown when the permission is denied.

System.NotSupportedException

The required feature is not supported.

API Level: 9
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/network.wifihttp://tizen.org/feature/network.telephonyhttp://tizen.org/feature/network.ethernet

Properties

View Source

BundlePolicy

Gets or sets the bundle policy.
The default bundle policy is MaxBundle.

Declaration
C#
Copy
public WebRTCBundlePolicy BundlePolicy { get; set; }
Property Value
Type Description
WebRTCBundlePolicy

The policy of bundle

Exceptions
Type Condition
ObjectDisposedException

The WebRTC has already been disposed.

API Level: 10
View Source

IceConnectionState

Gets the ICE connection state of the WebRTC.

Declaration
C#
Copy
public WebRTCIceConnectionState IceConnectionState { get; }
Property Value
Type Description
WebRTCIceConnectionState

The current ICE connection state of the WebRTC.

Exceptions
Type Condition
ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

IceGatheringState

Gets the Ice gathering state of the WebRTC.

Declaration
C#
Copy
public WebRTCIceGatheringState IceGatheringState { get; }
Property Value
Type Description
WebRTCIceGatheringState

The current Ice gathering state of the WebRTC.

Exceptions
Type Condition
ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

IceTransportPolicy

Gets or sets the ICE transport policy.

Declaration
C#
Copy
public IceTransportPolicy IceTransportPolicy { get; set; }
Property Value
Type Description
IceTransportPolicy

The policy of ICE transport

Exceptions
Type Condition
ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

PeerConnectionState

Gets the peer connection state of the WebRTC.

Declaration
C#
Copy
public WebRTCPeerConnectionState PeerConnectionState { get; }
Property Value
Type Description
WebRTCPeerConnectionState

The current peer connection state of the WebRTC.

Exceptions
Type Condition
ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

SignalingState

Gets the signaling state of the WebRTC.

Declaration
C#
Copy
public WebRTCSignalingState SignalingState { get; }
Property Value
Type Description
WebRTCSignalingState

The current signaling state of the WebRTC.

Exceptions
Type Condition
ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

State

Gets the state of the WebRTC.

Declaration
C#
Copy
public WebRTCState State { get; }
Property Value
Type Description
WebRTCState

The current state of the WebRTC.

Exceptions
Type Condition
ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

StunServer

Gets or sets the STUN server url.

Declaration
C#
Copy
public string StunServer { get; set; }
Property Value
Type Description
System.String

The STUN server url

Exceptions
Type Condition
System.ArgumentNullException

STUN server URI is null.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9

Methods

View Source

AddIceCandidate(String)

Adds a new ICE candidate from the remote peer over its signaling channel.

Declaration
C#
Copy
public void AddIceCandidate(string iceCandidate)
Parameters
Type Name Description
System.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.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

AddIceCandidates(IEnumerable<String>)

Adds new ICE candidates from the remote peer over its signaling channel.

Declaration
C#
Copy
public void AddIceCandidates(IEnumerable<string> iceCandidates)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.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.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

AddSource(MediaSource)

Adds media source.

Declaration
C#
Copy
public void AddSource(MediaSource source)
Parameters
Type Name Description
MediaSource source

The media sources to add.

Remarks

The WebRTC must be in the Idle.
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

The WebRTC is not in the valid state.

  • or -
    All or one of source was already detached.
System.NotSupportedException

The required feature is not supported.

ObjectDisposedException

The WebRTC has already been disposed.

UnauthorizedAccessException

Thrown when the permission is denied.

API Level: 9
Privilege Level: public
Privilege: http://tizen.org/privilege/camerahttp://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstoragehttp://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/camerahttp://tizen.org/feature/microphone
View Source

AddSources(MediaSource[])

Adds media sources.

Declaration
C#
Copy
public void AddSources(params MediaSource[] sources)
Parameters
Type Name Description
MediaSource[] sources

The media sources to add.

Remarks

The WebRTC must be in the Idle.
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

The WebRTC is not in the valid state.

  • or -
    All or one of sources was already detached.
System.NotSupportedException

The required feature is not supported.

ObjectDisposedException

The WebRTC has already been disposed.

UnauthorizedAccessException

Thrown when the permission is denied.

API Level: 9
Privilege Level: public
Privilege: http://tizen.org/privilege/camerahttp://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstoragehttp://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/camerahttp://tizen.org/feature/microphone
View Source

CreateAnswerAsync()

Creates SDP answer asynchronously with option to an offer received from a remote peer.

Declaration
C#
Copy
public Task<string> CreateAnswerAsync()
Returns
Type Description
System.Threading.Tasks.Task<System.String>

The SDP answer.

Remarks

The WebRTC must be in the Negotiating

Exceptions
Type Condition
System.InvalidOperationException

The WebRTC is not in the valid state.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

CreateOfferAsync()

Creates SDP offer asynchronously to start a new WebRTC connection to a remote peer.

Declaration
C#
Copy
public Task<string> CreateOfferAsync()
Returns
Type Description
System.Threading.Tasks.Task<System.String>

The SDP offer.

Remarks

The WebRTC must be in the Negotiating

Exceptions
Type Condition
System.InvalidOperationException

The WebRTC is not in the valid state.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

Dispose()

Releases all resources used by the current instance.

Declaration
C#
Copy
public void Dispose()
API Level: 9
View Source

GetStatistics(WebRTCStatisticsCategory)

Retrieves the current statistics information.

Declaration
C#
Copy
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<WebRTC.WebRTCStatistics>

The WebRTC statistics informations.

Remarks

The WebRTC must be in the Playing

Exceptions
Type Condition
ObjectDisposedException

The WebRTC has already been disposed.

System.InvalidOperationException

The WebRTC is not in the valid state.

API Level: 10
View Source

GetTurnServer()

Retrieves all turn servers.

Declaration
C#
Copy
public ReadOnlyCollection<string> GetTurnServer()
Returns
Type Description
System.Collections.ObjectModel.ReadOnlyCollection<System.String>

The turn server list.

Exceptions
Type Condition
ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

RemoveSource(MediaSource)

Removes media source.

Declaration
C#
Copy
public void RemoveSource(MediaSource source)
Parameters
Type Name Description
MediaSource source

The media source to remove.

Remarks

The WebRTC must be in the Idle.
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

The WebRTC is not in the valid state.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

RemoveSources(MediaSource[])

Removes media sources.

Declaration
C#
Copy
public void RemoveSources(params MediaSource[] sources)
Parameters
Type Name Description
MediaSource[] sources

The media source to remove.

Remarks

The WebRTC must be in the Idle.
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

The WebRTC is not in the valid state.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

SetLocalDescription(String)

Sets the session description for a local peer.

Declaration
C#
Copy
public void SetLocalDescription(string description)
Parameters
Type Name Description
System.String description

The local session description.

Remarks

The WebRTC must be in the Negotiating.

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.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

SetRemoteDescription(String)

Sets the session description of the remote peer's current offer or answer.

Declaration
C#
Copy
public void SetRemoteDescription(string description)
Parameters
Type Name Description
System.String description

The remote session description.

Remarks

The WebRTC must be in the Negotiating.

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.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

SetTurnServer(String)

Sets a turn server.

Declaration
C#
Copy
public void SetTurnServer(string turnServer)
Parameters
Type Name Description
System.String turnServer
Exceptions
Type Condition
System.ArgumentNullException

The turnServer is null.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

SetTurnServers(String[])

Sets turn servers.

Declaration
C#
Copy
public void SetTurnServers(params string[] turnServers)
Parameters
Type Name Description
System.String[] turnServers
Exceptions
Type Condition
System.ArgumentNullException

The one of turnServers is null.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

Start()

Starts the WebRTC.

Declaration
C#
Copy
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.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

StartAsync()

Starts the WebRTC asynchronously.

Declaration
C#
Copy
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.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9
View Source

Stop()

Stops the WebRTC.

Declaration
C#
Copy
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.

ObjectDisposedException

The WebRTC has already been disposed.

API Level: 9

Events

View Source

AudioFrameEncoded

Occurs when each audio frame is ready to render.

Declaration
C#
Copy
public event EventHandler<WebRTCFrameEncodedEventArgs> AudioFrameEncoded
Event Type
Type Description
System.EventHandler<WebRTCFrameEncodedEventArgs>
API Level: 9
View Source

DataChannel

Occurs when the data channel is created to the connection by the remote peer.

Declaration
C#
Copy
public event EventHandler<WebRTCDataChannelEventArgs> DataChannel
Event Type
Type Description
System.EventHandler<WebRTCDataChannelEventArgs>
API Level: 9
View Source

ErrorOccurred

Occurs when any error occurs.

Declaration
C#
Copy
public event EventHandler<WebRTCErrorOccurredEventArgs> ErrorOccurred
Event Type
Type Description
System.EventHandler<WebRTCErrorOccurredEventArgs>
API Level: 9
View Source

IceCandidate

Occurs when the WebRTC needs to send the ICE candidate message to the remote peer.

Declaration
C#
Copy
public event EventHandler<WebRTCIceCandidateEventArgs> IceCandidate
Event Type
Type Description
System.EventHandler<WebRTCIceCandidateEventArgs>
API Level: 9
View Source

IceConnectionStateChanged

Occurs when the WebRTC ICE connection state is changed.

Declaration
C#
Copy
public event EventHandler<WebRTCIceConnectionStateChangedEventArgs> IceConnectionStateChanged
Event Type
Type Description
System.EventHandler<WebRTCIceConnectionStateChangedEventArgs>
API Level: 9
View Source

IceGatheringStateChanged

Occurs when the WebRTC ICE gathering state is changed.

Declaration
C#
Copy
public event EventHandler<WebRTCIceGatheringStateChangedEventArgs> IceGatheringStateChanged
Event Type
Type Description
System.EventHandler<WebRTCIceGatheringStateChangedEventArgs>
API Level: 9
View Source

NegotiationNeeded

Occurs when negotiation is needed.

Declaration
C#
Copy
public event EventHandler<EventArgs> NegotiationNeeded
Event Type
Type Description
System.EventHandler<EventArgs>
API Level: 9
View Source

PeerConnectionStateChanged

Occurs when the WebRTC peer connection state is changed.

Declaration
C#
Copy
public event EventHandler<WebRTCPeerConnectionStateChangedEventArgs> PeerConnectionStateChanged
Event Type
Type Description
System.EventHandler<WebRTCPeerConnectionStateChangedEventArgs>
API Level: 9
View Source

SignalingStateChanged

Occurs when the WebRTC signaling state is changed.

Declaration
C#
Copy
public event EventHandler<WebRTCSignalingStateChangedEventArgs> SignalingStateChanged
Event Type
Type Description
System.EventHandler<WebRTCSignalingStateChangedEventArgs>
API Level: 9
View Source

StateChanged

Occurs when WebRTC state is changed.

Declaration
C#
Copy
public event EventHandler<WebRTCStateChangedEventArgs> StateChanged
Event Type
Type Description
System.EventHandler<WebRTCStateChangedEventArgs>
API Level: 9
View Source

TrackAdded

Occurs when a new track has been added to the WebRTC.

Declaration
C#
Copy
public event EventHandler<WebRTCTrackAddedEventArgs> TrackAdded
Event Type
Type Description
System.EventHandler<WebRTCTrackAddedEventArgs>
API Level: 9
View Source

VideoFrameEncoded

Occurs when each video frame is ready to render.

Declaration
C#
Copy
public event EventHandler<WebRTCFrameEncodedEventArgs> VideoFrameEncoded
Event Type
Type Description
System.EventHandler<WebRTCFrameEncodedEventArgs>
API Level: 9

Implements

System.IDisposable