Class StreamBase
Stream base properties/methods.
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class StreamBase : Dynamic, IStream
Constructors
StreamBase(StreamType)
Initializes a new instance of the StreamBase class.
Declaration
public StreamBase(StreamType type)
Parameters
Type | Name | Description |
---|---|---|
StreamType | type | The type. |
Properties
ConnectedTimestamp
Gets the ManagedStopwatch.GetTimestamp() value representing the ticks that passed when this stream's connection state changed to connected.
Declaration
protected long ConnectedTimestamp { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
ConnectionId
Gets the connection identifier.
Declaration
public string ConnectionId { get; }
Property Value
Type | Description |
---|---|
System.String |
Direction
Gets the current direction.
Declaration
public abstract StreamDirection Direction { get; }
Property Value
Type | Description |
---|---|
StreamDirection |
ExternalId
Gets or sets the external identifier.
Declaration
public string ExternalId { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Id
Gets the identifier.
Declaration
public string Id { get; }
Property Value
Type | Description |
---|---|
System.String |
IsTerminated
Gets a value indicating whether the stream is currently closed or failed.
Declaration
public bool IsTerminated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsTerminating
Gets a value indicating whether the stream is currently closing or failing.
Declaration
public bool IsTerminating { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsTerminatingOrTerminated
Gets a value indicating whether the stream is currently closing, failing, closed, or failed.
Declaration
public bool IsTerminatingOrTerminated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Label
Gets a label that identifies this class.
Declaration
public abstract string Label { get; }
Property Value
Type | Description |
---|---|
System.String |
LocalDirection
Gets or sets current direction indicated by the local description.
Declaration
public abstract StreamDirection LocalDirection { get; set; }
Property Value
Type | Description |
---|---|
StreamDirection |
LocalReceive
Gets or sets a value indicating whether the local peer supports receiving media on this stream.
Use this method to determine if a stream is used for sending media or only receiving media.
Declaration
public bool LocalReceive { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
LocalSend
Gets or sets a value indicating whether the local peer on this stream supports sending media on this stream.
Use this property to determine if a stream is used for sending media or only receiving media.
Declaration
public bool LocalSend { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
MediaDescriptionId
Gets the media description ID of this stream.
The media description ID is only available once a connection is opened with this stream, because it is obtained from the local SDP description of this stream.
Declaration
public string MediaDescriptionId { get; }
Property Value
Type | Description |
---|---|
System.String |
RemoteDirection
Gets or sets current direction indicated by the remote description.
Declaration
public abstract StreamDirection RemoteDirection { get; }
Property Value
Type | Description |
---|---|
StreamDirection |
RemoteReceive
Gets a value indicating whether receiving media is supported by the remote peer on this stream. Returns false if the remote stream direction has not been received.
Declaration
public bool RemoteReceive { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
RemoteSend
Gets a value indicating whether sending media is supported by the remote peer on this stream. Returns false if the remote stream direction has not been received.
Declaration
public bool RemoteSend { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
State
Gets or sets the state of the stream.
Declaration
public StreamState State { get; }
Property Value
Type | Description |
---|---|
StreamState |
Tag
Gets or sets optional data to associate with this instance.
Declaration
public string Tag { get; set; }
Property Value
Type | Description |
---|---|
System.String |
TransportInfo
Gets the stream transport info.
Declaration
public abstract TransportInfo TransportInfo { get; }
Property Value
Type | Description |
---|---|
TransportInfo |
Type
Gets or sets the type.
Declaration
public StreamType Type { get; }
Property Value
Type | Description |
---|---|
StreamType |
UseWssForMedia
Gets or sets a value indicating whether W
Declaration
public bool UseWssForMedia { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
ChangeDirection(StreamDirection)
Changes this stream's direction.
Declaration
public abstract Error ChangeDirection(StreamDirection newDirection)
Parameters
Type | Name | Description |
---|---|---|
StreamDirection | newDirection |
Returns
Type | Description |
---|---|
Error |
ProcessStateChange()
Processes a state change.
Declaration
protected virtual void ProcessStateChange()
ProcessStateLockChange()
Processes a state lock change.
Declaration
protected virtual void ProcessStateLockChange()
ProcessUpdateToMediaStreamIdentification(String)
Process update to the MediaDescription Identificiation.
Declaration
protected virtual void ProcessUpdateToMediaStreamIdentification(string oldValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | oldValue |
ToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Events
OnDirectionChange
Raised when the stream direction changes.
Stream direction indicates the direction of media flow. For example:
- A stream in an SFU upstream connection has a direction of SendOnly.
- A stream in an SFU downstream connection has a direction of ReceiveOnly.
- A stream in an MCU connection has a direction of SendReceive if it is attached to both local and remote media. If it is only attached to local media, it has a direction of SendOnly. If it is only attached to remote media, it has a direction of ReceiveOnly.
- An update to an SFU upstream connection might instruct the stream to stop sending audio or video frames. In this case, the direction of the stream changes to Inactive.
- An update to an SFU downstream connection might cause it to stop receiving audio or video frames. In this case, the direction of the stream changes to Inactive.
- An update to an MCU upstream connection might instruct the stream to stop sending audio or video frames. In this case, the following occurs:
- If the direction of the stream was SendOnly, then the direction changes to Inactive.
- If the direction of the stream was ReceiveOnly, then the direction changes to SendReceive.
- An update to an MCU upstream connection might instruct it to stop receiving audio or video frames. In this case, the following occurs:
- If the direction of the stream was ReceiveOnly, then the direction changes to Inactive.
- If the direction of the stream was SendReceive, then the direction changes to SendOnly.
Declaration
public event Action0 OnDirectionChange
Event Type
Type | Description |
---|---|
Action0 |
OnStateChange
Raised when the connection state changes.
This method can track the state of the connection and can be used to display the current status of the connection to the user, add or remove media views in the UI, and handle retry logic if the connection fails.
Possible connection states are the following:
- New: The connection object has been created, but open has not yet been called.
- Initializing: The connection is initializing, but no connection attempts have been made.
- Connecting: The connection is being established.
- Connected: The connection has been successfully established.
- Failing: The connection has encountered an error and is cleaning up.
- Failed: The connection encountered an error and has cleaned up.
- Closing: The connection has been instructed to close and is cleaning up.
- Closed: The connection has been instructed to close and has cleaned up.
Declaration
public event Action0 OnStateChange
Event Type
Type | Description |
---|---|
Action0 |