fm.liveswitch.StreamBase Class Referenceabstract

Stream base properties/methods. More...

Public Member Functions

void addOnDirectionChange (fm.liveswitch.IAction0 value)
 Adds a handler that is raised when the stream direction changes. More...
 
void addOnStateChange (fm.liveswitch.IAction0 value)
 Adds a handler that is raised when the connection state changes. More...
 
abstract fm.liveswitch.Error changeDirection (fm.liveswitch.StreamDirection newDirection)
 Changes this stream's direction. More...
 
String getConnectionId ()
 Gets the connection identifier. More...
 
abstract fm.liveswitch.StreamDirection getDirection ()
 Gets the current direction. More...
 
String getExternalId ()
 Gets the external identifier. More...
 
String getId ()
 Gets the identifier. More...
 
boolean getIsTerminated ()
 Gets a value indicating whether the stream is currently closed or failed. More...
 
boolean getIsTerminating ()
 Gets a value indicating whether the stream is currently closing or failing. More...
 
boolean getIsTerminatingOrTerminated ()
 Gets a value indicating whether the stream is currently closing, failing, closed, or failed. More...
 
abstract String getLabel ()
 Gets a label that identifies this class. More...
 
abstract fm.liveswitch.StreamDirection getLocalDirection ()
 Gets current direction indicated by the local description. More...
 
boolean getLocalReceive ()
 Gets a value indicating whether the local peer supports receiving media on this stream. More...
 
boolean getLocalSend ()
 Gets a value indicating whether the local peer on this stream supports sending media on this stream. More...
 
String getMediaDescriptionId ()
 Gets the media description ID of this stream. More...
 
abstract fm.liveswitch.StreamDirection getRemoteDirection ()
 Gets current direction indicated by the remote description. More...
 
boolean getRemoteReceive ()
 Gets a value indicating whether receiving media is supported by the remote peer on this stream. More...
 
boolean getRemoteSend ()
 Gets a value indicating whether sending media is supported by the remote peer on this stream. More...
 
fm.liveswitch.StreamState getState ()
 Gets the state of the stream. More...
 
String getTag ()
 Gets optional data to associate with this instance. More...
 
abstract fm.liveswitch.TransportInfo getTransportInfo ()
 Gets the stream transport info. More...
 
fm.liveswitch.StreamType getType ()
 Gets the type. More...
 
void removeOnDirectionChange (fm.liveswitch.IAction0 value)
 Removes a handler that is raised when the stream direction changes. More...
 
void removeOnStateChange (fm.liveswitch.IAction0 value)
 Removes a handler that is raised when the connection state changes. More...
 
void setExternalId (String value)
 Sets the external identifier. More...
 
abstract void setLocalDirection (fm.liveswitch.StreamDirection value)
 Sets current direction indicated by the local description. More...
 
void setLocalReceive (boolean value)
 Sets a value indicating whether the local peer supports receiving media on this stream. More...
 
void setLocalSend (boolean value)
 Sets a value indicating whether the local peer on this stream supports sending media on this stream. More...
 
void setTag (String value)
 Sets optional data to associate with this instance. More...
 
 StreamBase (fm.liveswitch.StreamType type)
 Initializes a new instance of the fm.liveswitch.StreamBase class. More...
 
String toString ()
 Returns a string that represents this instance. More...
 
- Public Member Functions inherited from fm.liveswitch.Dynamic
java.util.HashMap< String, Object > getDynamicProperties ()
 Gets all dynamic properties on this instance. More...
 
Object getDynamicValue (String key)
 Gets a property value from the local cache. More...
 
void setDynamicValue (String key, Object value)
 Sets a property value in the local cache. More...
 
boolean unsetDynamicValue (String key)
 Removes a property value from the local cache. More...
 

Protected Member Functions

long getConnectedTimestamp ()
 Gets the ManagedStopwatch.GetTimestamp() value representing the ticks that passed when this stream's connection state changed to connected. More...
 
void processStateChange ()
 Processes a state change. More...
 
void processStateLockChange ()
 Processes a state lock change. More...
 
void processUpdateToMediaStreamIdentification (String oldValue)
 Process update to the MediaDescription Identificiation. More...
 
- Protected Member Functions inherited from fm.liveswitch.Dynamic
 Dynamic ()
 
- Protected Member Functions inherited from fm.liveswitch.Serializable
boolean getIsDirty ()
 Gets a value indicating whether this instance is dirty. More...
 
 Serializable ()
 Initializes a new instance of the fm.liveswitch.Serializable class. More...
 
void setIsDirty (boolean value)
 Sets a value indicating whether this instance is dirty. More...
 

Detailed Description

Stream base properties/methods.

Constructor & Destructor Documentation

◆ StreamBase()

fm.liveswitch.StreamBase.StreamBase ( fm.liveswitch.StreamType  type)

Initializes a new instance of the fm.liveswitch.StreamBase class.

Parameters
typeThe type.

Member Function Documentation

◆ addOnDirectionChange()

void fm.liveswitch.StreamBase.addOnDirectionChange ( fm.liveswitch.IAction0  value)

Adds a handler that is 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.

The direction of a stream can change over its lifecycle. For example:

  • 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.

An event handler bound to the change in direction can be used to update the UI accordingly so the user is aware of the change in the state of the application.

Implements fm.liveswitch.IStream.

◆ addOnStateChange()

void fm.liveswitch.StreamBase.addOnStateChange ( fm.liveswitch.IAction0  value)

Adds a handler that is 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.

Implements fm.liveswitch.IStream.

◆ changeDirection()

abstract fm.liveswitch.Error fm.liveswitch.StreamBase.changeDirection ( fm.liveswitch.StreamDirection  newDirection)
abstract

Changes this stream's direction.

Implements fm.liveswitch.IStream.

Reimplemented in fm.liveswitch.MediaStreamBase.

◆ getConnectedTimestamp()

long fm.liveswitch.StreamBase.getConnectedTimestamp ( )
protected

Gets the ManagedStopwatch.GetTimestamp() value representing the ticks that passed when this stream's connection state changed to connected.

◆ getConnectionId()

String fm.liveswitch.StreamBase.getConnectionId ( )

Gets the connection identifier.

◆ getDirection()

abstract fm.liveswitch.StreamDirection fm.liveswitch.StreamBase.getDirection ( )
abstract

Gets the current direction.

Implements fm.liveswitch.IStream.

Reimplemented in fm.liveswitch.MediaStreamBase.

◆ getExternalId()

String fm.liveswitch.StreamBase.getExternalId ( )

Gets the external identifier.

Implements fm.liveswitch.IStream.

◆ getId()

String fm.liveswitch.StreamBase.getId ( )

Gets the identifier.

Implements fm.liveswitch.IStream.

◆ getIsTerminated()

boolean fm.liveswitch.StreamBase.getIsTerminated ( )

Gets a value indicating whether the stream is currently closed or failed.

◆ getIsTerminating()

boolean fm.liveswitch.StreamBase.getIsTerminating ( )

Gets a value indicating whether the stream is currently closing or failing.

◆ getIsTerminatingOrTerminated()

boolean fm.liveswitch.StreamBase.getIsTerminatingOrTerminated ( )

Gets a value indicating whether the stream is currently closing, failing, closed, or failed.

◆ getLabel()

abstract String fm.liveswitch.StreamBase.getLabel ( )
abstract

Gets a label that identifies this class.

Implements fm.liveswitch.IStream.

Reimplemented in fm.liveswitch.MediaStreamBase.

◆ getLocalDirection()

abstract fm.liveswitch.StreamDirection fm.liveswitch.StreamBase.getLocalDirection ( )
abstract

Gets current direction indicated by the local description.

Implements fm.liveswitch.IStream.

Reimplemented in fm.liveswitch.MediaStreamBase.

◆ getLocalReceive()

boolean fm.liveswitch.StreamBase.getLocalReceive ( )

Gets 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.

Implements fm.liveswitch.IStream.

◆ getLocalSend()

boolean fm.liveswitch.StreamBase.getLocalSend ( )

Gets 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.

Implements fm.liveswitch.IStream.

◆ getMediaDescriptionId()

String fm.liveswitch.StreamBase.getMediaDescriptionId ( )

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.

Implements fm.liveswitch.IStream.

◆ getRemoteDirection()

abstract fm.liveswitch.StreamDirection fm.liveswitch.StreamBase.getRemoteDirection ( )
abstract

Gets current direction indicated by the remote description.

Implements fm.liveswitch.IStream.

Reimplemented in fm.liveswitch.MediaStreamBase.

◆ getRemoteReceive()

boolean fm.liveswitch.StreamBase.getRemoteReceive ( )

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.

Implements fm.liveswitch.IStream.

◆ getRemoteSend()

boolean fm.liveswitch.StreamBase.getRemoteSend ( )

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.

Implements fm.liveswitch.IStream.

◆ getState()

fm.liveswitch.StreamState fm.liveswitch.StreamBase.getState ( )

Gets the state of the stream.

Implements fm.liveswitch.IStream.

◆ getTag()

String fm.liveswitch.StreamBase.getTag ( )

Gets optional data to associate with this instance.

Implements fm.liveswitch.IStream.

◆ getTransportInfo()

abstract fm.liveswitch.TransportInfo fm.liveswitch.StreamBase.getTransportInfo ( )
abstract

Gets the stream transport info.

Implements fm.liveswitch.IStream.

Reimplemented in fm.liveswitch.DataStream.

◆ getType()

fm.liveswitch.StreamType fm.liveswitch.StreamBase.getType ( )

Gets the type.

Implements fm.liveswitch.IStream.

◆ processStateChange()

void fm.liveswitch.StreamBase.processStateChange ( )
protected

Processes a state change.

◆ processStateLockChange()

void fm.liveswitch.StreamBase.processStateLockChange ( )
protected

Processes a state lock change.

◆ processUpdateToMediaStreamIdentification()

void fm.liveswitch.StreamBase.processUpdateToMediaStreamIdentification ( String  oldValue)
protected

Process update to the MediaDescription Identificiation.

◆ removeOnDirectionChange()

void fm.liveswitch.StreamBase.removeOnDirectionChange ( fm.liveswitch.IAction0  value)

Removes a handler that is 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.

The direction of a stream can change over its lifecycle. For example:

  • 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.

An event handler bound to the change in direction can be used to update the UI accordingly so the user is aware of the change in the state of the application.

Implements fm.liveswitch.IStream.

◆ removeOnStateChange()

void fm.liveswitch.StreamBase.removeOnStateChange ( fm.liveswitch.IAction0  value)

Removes a handler that is 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.

Implements fm.liveswitch.IStream.

◆ setExternalId()

void fm.liveswitch.StreamBase.setExternalId ( String  value)

Sets the external identifier.

Implements fm.liveswitch.IStream.

◆ setLocalDirection()

abstract void fm.liveswitch.StreamBase.setLocalDirection ( fm.liveswitch.StreamDirection  value)
abstract

Sets current direction indicated by the local description.

Implements fm.liveswitch.IStream.

Reimplemented in fm.liveswitch.MediaStreamBase.

◆ setLocalReceive()

void fm.liveswitch.StreamBase.setLocalReceive ( boolean  value)

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.

Implements fm.liveswitch.IStream.

◆ setLocalSend()

void fm.liveswitch.StreamBase.setLocalSend ( boolean  value)

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.

Implements fm.liveswitch.IStream.

◆ setTag()

void fm.liveswitch.StreamBase.setTag ( String  value)

Sets optional data to associate with this instance.

Implements fm.liveswitch.IStream.

◆ toString()

String fm.liveswitch.StreamBase.toString ( )

Returns a string that represents this instance.