Class ConnectionBase<TConnection, TStream, TAudioStream, TVideoStream, TDataStream, TDataChannel>
Connection base properties/methods.
Inheritance
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class ConnectionBase<TConnection, TStream, TAudioStream, TVideoStream, TDataStream, TDataChannel> : Dynamic, IEquatable<NSObject>, INSObjectProtocol, INativeObject, IDisposable, IConnection<TConnection, TStream, TAudioStream, TVideoStream, TDataStream> where TConnection : ConnectionBase<TConnection, TStream, TAudioStream, TVideoStream, TDataStream, TDataChannel> where TStream : StreamBase where TAudioStream : TStream, IAudioStream where TVideoStream : TStream, IVideoStream where TDataStream : TStream, IDataStream<TDataChannel> where TDataChannel : IDataChannel<TDataChannel>
Type Parameters
| Name | Description |
|---|---|
| TConnection | |
| TStream | |
| TAudioStream | |
| TVideoStream | |
| TDataStream | |
| TDataChannel |
Constructors
ConnectionBase(Object)
Initializes a new instance of the ConnectionBase<TConnection, TStream, TAudioStream, TVideoStream, TDataStream, TDataChannel> class.
Declaration
public ConnectionBase(object sharedLock)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sharedLock |
Fields
ConnectionLock
The state lock.
Declaration
protected object ConnectionLock
Field Value
| Type | Description |
|---|---|
| System.Object |
Properties
AudioStream
Gets the first audio stream.
Declaration
public TAudioStream AudioStream { get; }
Property Value
| Type | Description |
|---|---|
| TAudioStream |
AudioStreams
Gets the audio streams.
Declaration
public abstract TAudioStream[] AudioStreams { get; }
Property Value
| Type | Description |
|---|---|
| TAudioStream[] |
BundlePolicy
Gets or sets the bundle policy.
Declaration
public BundlePolicy BundlePolicy { get; set; }
Property Value
| Type | Description |
|---|---|
| BundlePolicy |
CanonicalName
Gets the canonical name.
Declaration
[Obsolete("Use MediaStream.LocalCanonicalName instead.")]
public string CanonicalName { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Closed
Gets a future that resolves if the connection enters the Closed state or rejects if the connection enters the Failed state before that happens.
Declaration
public Future<object> Closed { get; }
Property Value
| Type | Description |
|---|---|
| Future<System.Object> |
Connected
Gets a future that resolves if the connection enters the Connected state or rejects if the connection enters the Failed state before that happens.
Declaration
public Future<object> Connected { get; }
Property Value
| Type | Description |
|---|---|
| Future<System.Object> |
DataStream
Gets the first data stream.
Declaration
public TDataStream DataStream { get; }
Property Value
| Type | Description |
|---|---|
| TDataStream |
DataStreams
Gets the data streams.
Declaration
public abstract TDataStream[] DataStreams { get; }
Property Value
| Type | Description |
|---|---|
| TDataStream[] |
DeadStreamTimeout
Gets or sets the amount of time (in milliseconds) to wait for connectivity checks to re-establish after they start to fail on a live connection. Defaults to 15,000.
Declaration
public int DeadStreamTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Error
Gets or sets the error.
Declaration
public Error Error { get; set; }
Property Value
| Type | Description |
|---|---|
| Error |
ExternalId
Gets or sets the external identifier.
Declaration
public string ExternalId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Failed
Gets a future that resolves if the connection enters the Failed state or rejects if the connection enters the Closed state before that happens.
Declaration
public Future<object> Failed { get; }
Property Value
| Type | Description |
|---|---|
| Future<System.Object> |
GatheringState
Gets or sets the ICE gathering state.
Declaration
public abstract IceGatheringState GatheringState { get; protected set; }
Property Value
| Type | Description |
|---|---|
| IceGatheringState |
HasAudio
Gets whether this connection has an audio stream.
Declaration
public bool HasAudio { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
HasData
Gets whether this connection has a data stream.
Declaration
public bool HasData { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
HasVideo
Gets whether this connection has a video stream.
Declaration
public bool HasVideo { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IceConnectionState
Gets or sets the ICE connection state.
Declaration
public abstract IceConnectionState IceConnectionState { get; protected set; }
Property Value
| Type | Description |
|---|---|
| IceConnectionState |
IceGatherPolicy
Gets or sets the ICE gather policy.
Declaration
public IceGatherPolicy IceGatherPolicy { get; set; }
Property Value
| Type | Description |
|---|---|
| IceGatherPolicy |
IceServer
Gets or sets the ICE server.
Declaration
public IceServer IceServer { get; set; }
Property Value
| Type | Description |
|---|---|
| IceServer |
IceServers
Gets or sets the ICE servers.
Declaration
public IceServer[] IceServers { get; set; }
Property Value
| Type | Description |
|---|---|
| IceServer[] |
Id
Gets the identifier.
Declaration
public string Id { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Instance
Gets the current instance.
Declaration
protected abstract TConnection Instance { get; }
Property Value
| Type | Description |
|---|---|
| TConnection |
IsTerminated
Gets a value indicating whether the connection is currently closed or failed.
Declaration
public bool IsTerminated { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsTerminating
Gets a value indicating whether the connection is currently closing or failing.
Declaration
public bool IsTerminating { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsTerminatingOrTerminated
Gets a value indicating whether the connection is currently closing, failing, closed, or failed.
Declaration
public bool IsTerminatingOrTerminated { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
LegacyTimeout
Gets or sets a value indicating whether legacy Connection.Timeout should be used. When disabled, Connection.Timeout only accounts for the time spent trying to establish connectivity (i.e. time it takes to transition from the Connecting to the Connected state; from the time point when both offer and answer had been set to the connection being fully established). When enabled, Connection.Timeout accounts for the time spent from receiving an offer (or creating an offer) to establishing connectivity (i.e. time it takes to transition from Initializing to Connected state). By default, LegacyTimeout is set to true, so that existing behavior is preserved. However, in the future default will be updated to false. This means that IL will not account for any signalling delays that may occur while establishing connectivity. This option will be later deprecated.
Declaration
public bool LegacyTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
LocalDescription
Gets the local description.
Declaration
public abstract SessionDescription LocalDescription { get; }
Property Value
| Type | Description |
|---|---|
| SessionDescription |
MediaProtocol
Gets or sets the media protocol in use on this connection.
Declaration
public MediaProtocol MediaProtocol { get; set; }
Property Value
| Type | Description |
|---|---|
| MediaProtocol |
RemoteDescription
Gets the remote description.
Declaration
public abstract SessionDescription RemoteDescription { get; }
Property Value
| Type | Description |
|---|---|
| SessionDescription |
SignallingState
Gets or sets the state of the signalling.
Declaration
public SignallingState SignallingState { get; protected set; }
Property Value
| Type | Description |
|---|---|
| SignallingState |
State
Gets or sets the state of the connection.
Declaration
public ConnectionState State { get; }
Property Value
| Type | Description |
|---|---|
| ConnectionState |
Stream
Gets the first stream.
Declaration
public TStream Stream { get; }
Property Value
| Type | Description |
|---|---|
| TStream |
Streams
Gets the streams.
Declaration
public abstract TStream[] Streams { get; }
Property Value
| Type | Description |
|---|---|
| TStream[] |
TieBreaker
Gets or sets the tie breaker.
Declaration
public string TieBreaker { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Timeout
Gets or sets the amount of time (in milliseconds) to wait for a connection to establish before giving up and closing it. Defaults to 30,000.
Declaration
public int Timeout { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
TrickleIcePolicy
Gets or sets Trickle Ice Support Policy. Cf. https://tools.ietf.org/html/draft-ietf-ice-trickle-05
Declaration
public TrickleIcePolicy TrickleIcePolicy { get; set; }
Property Value
| Type | Description |
|---|---|
| TrickleIcePolicy |
VideoStream
Gets the first video stream.
Declaration
public TVideoStream VideoStream { get; }
Property Value
| Type | Description |
|---|---|
| TVideoStream |
VideoStreams
Gets the video streams.
Declaration
public abstract TVideoStream[] VideoStreams { get; }
Property Value
| Type | Description |
|---|---|
| TVideoStream[] |
Methods
AddIceServer(IceServer)
Adds an ICE server.
Declaration
public void AddIceServer(IceServer iceServer)
Parameters
| Type | Name | Description |
|---|---|---|
| IceServer | iceServer | The ICE server. |
AddIceServers(IceServer[])
Adds some ICE servers.
Declaration
public void AddIceServers(IceServer[] iceServers)
Parameters
| Type | Name | Description |
|---|---|---|
| IceServer[] | iceServers | The ICE servers. |
AddRemoteCandidate(Candidate)
Adds the remote candidate.
Declaration
public Future<Candidate> AddRemoteCandidate(Candidate remoteCandidate)
Parameters
| Type | Name | Description |
|---|---|---|
| Candidate | remoteCandidate | The remote candidate. |
Returns
| Type | Description |
|---|---|
| Future<Candidate> |
Close()
Closes this instance.
Declaration
public abstract bool Close()
Returns
| Type | Description |
|---|---|
| System.Boolean |
CreateAnswer()
Creates an answer.
Declaration
public Future<SessionDescription> CreateAnswer()
Returns
| Type | Description |
|---|---|
| Future<SessionDescription> |
CreateOffer()
Creates an offer.
Declaration
public Future<SessionDescription> CreateOffer()
Returns
| Type | Description |
|---|---|
| Future<SessionDescription> |
DoAddRemoteCandidate(Promise<Candidate>, Candidate)
Adds the remote candidate.
Declaration
protected abstract void DoAddRemoteCandidate(Promise<Candidate> promise, Candidate remoteCandidate)
Parameters
| Type | Name | Description |
|---|---|---|
| Promise<Candidate> | promise | The promise. |
| Candidate | remoteCandidate | The remote candidate. |
DoCreateAnswer(Promise<SessionDescription>)
Creates an answer.
Declaration
protected abstract void DoCreateAnswer(Promise<SessionDescription> promise)
Parameters
| Type | Name | Description |
|---|---|---|
| Promise<SessionDescription> | promise |
DoCreateOffer(Promise<SessionDescription>)
Creates an offer.
Declaration
protected abstract bool DoCreateOffer(Promise<SessionDescription> promise)
Parameters
| Type | Name | Description |
|---|---|---|
| Promise<SessionDescription> | promise |
Returns
| Type | Description |
|---|---|
| System.Boolean |
DoProcessDescription(SessionDescription, Boolean)
Processes a session description.
Declaration
protected virtual Error DoProcessDescription(SessionDescription description, bool isLocalDescription)
Parameters
| Type | Name | Description |
|---|---|---|
| SessionDescription | description | The session description. |
| System.Boolean | isLocalDescription | Whether this is a local session description. |
Returns
| Type | Description |
|---|---|
| Error |
DoSendCachedLocalCandidates()
Dispatches cached local candidates that were gathered while Connection generated session description.
Declaration
protected abstract void DoSendCachedLocalCandidates()
DoSetLocalDescription(Promise<SessionDescription>, SessionDescription)
Sets the local description.
Declaration
protected abstract void DoSetLocalDescription(Promise<SessionDescription> promise, SessionDescription localDescription)
Parameters
| Type | Name | Description |
|---|---|---|
| Promise<SessionDescription> | promise | The promise. |
| SessionDescription | localDescription | The local description. |
DoSetRemoteDescription(Promise<SessionDescription>, SessionDescription)
Sets the remote description.
Declaration
protected abstract void DoSetRemoteDescription(Promise<SessionDescription> promise, SessionDescription remoteDescription)
Parameters
| Type | Name | Description |
|---|---|---|
| Promise<SessionDescription> | promise | The promise. |
| SessionDescription | remoteDescription | The remote description. |
GetConnectionWideCanonicalName()
Gets connection-wide canonical name. This is in use to set CanonicalName on Connection and DataStream, which is obsolete.
Declaration
protected string GetConnectionWideCanonicalName()
Returns
| Type | Description |
|---|---|
| System.String |
GetStats()
Gets the current connection stats.
Declaration
public abstract Future<ConnectionStats> GetStats()
Returns
| Type | Description |
|---|---|
| Future<ConnectionStats> |
ProcessDescription(SessionDescription, Boolean)
Processes a session description.
Declaration
protected Error ProcessDescription(SessionDescription description, bool isLocalDescription)
Parameters
| Type | Name | Description |
|---|---|---|
| SessionDescription | description | The session description. |
| System.Boolean | isLocalDescription | Whether this is a local session description. |
Returns
| Type | Description |
|---|---|
| Error |
ProcessStateChange()
Processes a state change.
Declaration
protected virtual void ProcessStateChange()
RaiseGatheringStateChange(TConnection)
Raises gathering state change.
Declaration
protected void RaiseGatheringStateChange(TConnection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| TConnection | connection |
RaiseIceConnectionStateChange(TConnection)
Raises ICE connection state change.
Declaration
protected void RaiseIceConnectionStateChange(TConnection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| TConnection | connection |
RaiseLocalCandidate(Candidate)
Raises a local candidate but only if it has not been already raised.
Declaration
protected virtual void RaiseLocalCandidate(Candidate localCandidate)
Parameters
| Type | Name | Description |
|---|---|---|
| Candidate | localCandidate | The local candidate. |
RegisterStreamWithSessionDescriptionManager(TStream)
Registers stream with the session description manager.
Declaration
protected void RegisterStreamWithSessionDescriptionManager(TStream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| TStream | stream |
RemoveIceServer(IceServer)
Removes an ICE server.
Declaration
public void RemoveIceServer(IceServer iceServer)
Parameters
| Type | Name | Description |
|---|---|---|
| IceServer | iceServer | The ICE server. |
RemoveIceServers(IceServer[])
Removes some ICE servers.
Declaration
public void RemoveIceServers(IceServer[] iceServers)
Parameters
| Type | Name | Description |
|---|---|---|
| IceServer[] | iceServers | The ICE servers. |
SetLocalDescription(SessionDescription)
Sets the local description.
Declaration
public Future<SessionDescription> SetLocalDescription(SessionDescription localDescription)
Parameters
| Type | Name | Description |
|---|---|---|
| SessionDescription | localDescription | The local description. |
Returns
| Type | Description |
|---|---|
| Future<SessionDescription> |
SetRemoteDescription(SessionDescription)
Sets the remote description.
Declaration
public Future<SessionDescription> SetRemoteDescription(SessionDescription remoteDescription)
Parameters
| Type | Name | Description |
|---|---|---|
| SessionDescription | remoteDescription | The remote description. |
Returns
| Type | Description |
|---|---|
| Future<SessionDescription> |
UnregisterStreamWithSessionDescriptionManager(TStream)
Unregisters stream with the session description manager.
Declaration
protected void UnregisterStreamWithSessionDescriptionManager(TStream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| TStream | stream |
UpdateBundlePolicy(BundlePolicy)
Updates bundle policy for the non-base connection classes on individual platforms.
Declaration
protected virtual void UpdateBundlePolicy(BundlePolicy policy)
Parameters
| Type | Name | Description |
|---|---|---|
| BundlePolicy | policy |
Events
OnExternalIdChange
Raised when external Id of this connection changes. Old external Id as well as internal Id are raised.
Declaration
public event Action2<string, string> OnExternalIdChange
Event Type
| Type | Description |
|---|---|
| Action2<System.String, System.String> |
OnGatheringStateChange
Raised when the gathering state changes.
Declaration
public event Action1<TConnection> OnGatheringStateChange
Event Type
| Type | Description |
|---|---|
| Action1<TConnection> |
OnIceConnectionStateChange
Raised when the ice connection state changes.
Declaration
public event Action1<TConnection> OnIceConnectionStateChange
Event Type
| Type | Description |
|---|---|
| Action1<TConnection> |
OnLocalCandidate
Raised when a local candidate is added.
Declaration
public event Action2<TConnection, Candidate> OnLocalCandidate
Event Type
| Type | Description |
|---|---|
| Action2<TConnection, Candidate> |
OnLocalDescription
Raised when a local description is set.
Declaration
public event Action2<TConnection, SessionDescription> OnLocalDescription
Event Type
| Type | Description |
|---|---|
| Action2<TConnection, SessionDescription> |
OnRemoteCandidate
Raised when a remote description is added.
Declaration
public event Action2<TConnection, Candidate> OnRemoteCandidate
Event Type
| Type | Description |
|---|---|
| Action2<TConnection, Candidate> |
OnRemoteDescription
Raised when a remote description is set.
Declaration
public event Action2<TConnection, SessionDescription> OnRemoteDescription
Event Type
| Type | Description |
|---|---|
| Action2<TConnection, SessionDescription> |
OnSignallingStateChange
Raised when the signalling state changes.
Declaration
public event Action1<TConnection> OnSignallingStateChange
Event Type
| Type | Description |
|---|---|
| Action1<TConnection> |
OnStateChange
Raised when the connection state changes.
Declaration
public event Action1<TConnection> OnStateChange
Event Type
| Type | Description |
|---|---|
| Action1<TConnection> |