FMLiveSwitchStreamBase Class Reference

Stream base properties/methods. More...

Instance Methods

(void) - addOnDirectionChange:
 Adds a handler that is raised when the stream direction changes. More...
 
(void) - addOnStateChange:
 Adds a handler that is raised when the connection state changes. More...
 
(FMLiveSwitchError *) - changeDirectionWithNewDirection:
 Changes this stream's direction. More...
 
(long long) - connectedTimestamp
 Gets the ManagedStopwatch.GetTimestamp() value representing the ticks that passed when this stream's connection state changed to connected. More...
 
(NSString *) - connectionId
 Gets the connection identifier. More...
 
(NSString *) - description
 Returns a string that represents this instance. More...
 
(FMLiveSwitchStreamDirection) - direction
 Gets the current direction. More...
 
(NSString *) - externalId
 Gets the external identifier. More...
 
(NSString *) - id
 Gets the identifier. More...
 
(instancetype) - initWithType:
 Initializes a new instance of the FMLiveSwitchStreamBase class. More...
 
(bool) - isTerminated
 Gets a value indicating whether the stream is currently closed or failed. More...
 
(bool) - isTerminating
 Gets a value indicating whether the stream is currently closing or failing. More...
 
(bool) - isTerminatingOrTerminated
 Gets a value indicating whether the stream is currently closing, failing, closed, or failed. More...
 
(NSString *) - label
 Gets a label that identifies this class. More...
 
(FMLiveSwitchStreamDirection) - localDirection
 Gets current direction indicated by the local description. More...
 
(bool) - localReceive
 Gets a value indicating whether the local peer supports receiving media on this stream. More...
 
(bool) - localSend
 Gets a value indicating whether the local peer on this stream supports sending media on this stream. More...
 
(NSString *) - mediaDescriptionId
 Gets the media description ID of this stream. More...
 
(void) - processStateChange
 Processes a state change. More...
 
(void) - processStateLockChange
 Processes a state lock change. More...
 
(FMLiveSwitchStreamDirection) - remoteDirection
 Gets current direction indicated by the remote description. More...
 
(bool) - remoteReceive
 Gets a value indicating whether receiving media is supported by the remote peer on this stream. More...
 
(bool) - remoteSend
 Gets a value indicating whether sending media is supported by the remote peer on this stream. More...
 
(void) - removeOnDirectionChange:
 Removes a handler that is raised when the stream direction changes. More...
 
(void) - removeOnStateChange:
 Removes a handler that is raised when the connection state changes. More...
 
(void) - setExternalId:
 Sets the external identifier. More...
 
(void) - setLocalDirection:
 Sets current direction indicated by the local description. More...
 
(void) - setLocalReceive:
 Sets a value indicating whether the local peer supports receiving media on this stream. More...
 
(void) - setLocalSend:
 Sets a value indicating whether the local peer on this stream supports sending media on this stream. More...
 
(void) - setTag:
 Sets optional data to associate with this instance. More...
 
(FMLiveSwitchStreamState) - state
 Gets the state of the stream. More...
 
(NSString *) - tag
 Gets optional data to associate with this instance. More...
 
(FMLiveSwitchTransportInfo *) - transportInfo
 Gets the stream transport info. More...
 
(FMLiveSwitchStreamType) - type
 Gets the type. More...
 
- Instance Methods inherited from FMLiveSwitchDynamic
(NSMutableDictionary< NSString *, id > *) - dynamicProperties
 Gets all dynamic properties on this instance. More...
 
(id- getDynamicValueWithKey:
 Gets a property value from the local cache. More...
 
(instancetype) - init
 Initializes a new instance of the FMLiveSwitchSerializable class. More...
 
(void) - setDynamicValueWithKey:value:
 Sets a property value in the local cache. More...
 
(bool) - unsetDynamicValueWithKey:
 Removes a property value from the local cache. More...
 

Class Methods

(FMLiveSwitchStreamBase *) + streamBaseWithType:
 Initializes a new instance of the FMLiveSwitchStreamBase class. More...
 
- Class Methods inherited from FMLiveSwitchDynamic
(FMLiveSwitchDynamic *) + dynamic
 
- Class Methods inherited from FMLiveSwitchSerializable
(FMLiveSwitchSerializable *) + serializable
 Initializes a new instance of the FMLiveSwitchSerializable class. More...
 

Detailed Description

Stream base properties/methods.

Method Documentation

◆ addOnDirectionChange:

- (void) addOnDirectionChange: (FMLiveSwitchAction0 *)  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.

Reimplemented from <FMLiveSwitchIStream>.

◆ addOnStateChange:

- (void) addOnStateChange: (FMLiveSwitchAction0 *)  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.

Reimplemented from <FMLiveSwitchIStream>.

◆ changeDirectionWithNewDirection:

- (FMLiveSwitchError*) changeDirectionWithNewDirection: (FMLiveSwitchStreamDirection)  newDirection

Changes this stream's direction.

Reimplemented from <FMLiveSwitchIStream>.

Implemented in FMLiveSwitchMediaStreamBase.

◆ connectedTimestamp

- (long long) connectedTimestamp

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

◆ connectionId

- (NSString*) connectionId

Gets the connection identifier.

◆ description

- (NSString*) description

Returns a string that represents this instance.

◆ direction

- (FMLiveSwitchStreamDirection) direction

Gets the current direction.

Reimplemented from <FMLiveSwitchIStream>.

Implemented in FMLiveSwitchMediaStreamBase.

◆ externalId

- (NSString*) externalId

Gets the external identifier.

Reimplemented from <FMLiveSwitchIStream>.

◆ id

- (NSString*) id

Gets the identifier.

Reimplemented from <FMLiveSwitchIStream>.

◆ initWithType:

- (instancetype) initWithType: (FMLiveSwitchStreamType)  type

Initializes a new instance of the FMLiveSwitchStreamBase class.

Parameters
typeThe type.

Implemented in FMLiveSwitchStream, and FMLiveSwitchMediaStreamBase.

◆ isTerminated

- (bool) isTerminated

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

◆ isTerminating

- (bool) isTerminating

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

◆ isTerminatingOrTerminated

- (bool) isTerminatingOrTerminated

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

◆ label

- (NSString*) label

Gets a label that identifies this class.

Reimplemented from <FMLiveSwitchIStream>.

Implemented in FMLiveSwitchMediaStreamBase.

◆ localDirection

- (FMLiveSwitchStreamDirection) localDirection

Gets current direction indicated by the local description.

Reimplemented from <FMLiveSwitchIStream>.

Implemented in FMLiveSwitchMediaStreamBase.

◆ localReceive

- (bool) localReceive

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.

Reimplemented from <FMLiveSwitchIStream>.

◆ localSend

- (bool) localSend

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.

Reimplemented from <FMLiveSwitchIStream>.

◆ mediaDescriptionId

- (NSString*) 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.

Reimplemented from <FMLiveSwitchIStream>.

◆ processStateChange

- (void) processStateChange

Processes a state change.

◆ processStateLockChange

- (void) processStateLockChange

Processes a state lock change.

◆ remoteDirection

- (FMLiveSwitchStreamDirection) remoteDirection

Gets current direction indicated by the remote description.

Reimplemented from <FMLiveSwitchIStream>.

Implemented in FMLiveSwitchMediaStreamBase.

◆ remoteReceive

- (bool) 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.

Reimplemented from <FMLiveSwitchIStream>.

◆ remoteSend

- (bool) 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.

Reimplemented from <FMLiveSwitchIStream>.

◆ removeOnDirectionChange:

- (void) removeOnDirectionChange: (FMLiveSwitchAction0 *)  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.

Reimplemented from <FMLiveSwitchIStream>.

◆ removeOnStateChange:

- (void) removeOnStateChange: (FMLiveSwitchAction0 *)  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.

Reimplemented from <FMLiveSwitchIStream>.

◆ setExternalId:

- (void) setExternalId: (NSString *)  value

Sets the external identifier.

Reimplemented from <FMLiveSwitchIStream>.

◆ setLocalDirection:

- (void) setLocalDirection: (FMLiveSwitchStreamDirection)  value

Sets current direction indicated by the local description.

Reimplemented from <FMLiveSwitchIStream>.

Implemented in FMLiveSwitchMediaStreamBase.

◆ setLocalReceive:

- (void) setLocalReceive: (bool)  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.

Reimplemented from <FMLiveSwitchIStream>.

◆ setLocalSend:

- (void) setLocalSend: (bool)  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.

Reimplemented from <FMLiveSwitchIStream>.

◆ setTag:

- (void) setTag: (NSString *)  value

Sets optional data to associate with this instance.

Reimplemented from <FMLiveSwitchIStream>.

◆ state

- (FMLiveSwitchStreamState) state

Gets the state of the stream.

Reimplemented from <FMLiveSwitchIStream>.

◆ streamBaseWithType:

+ (FMLiveSwitchStreamBase*) streamBaseWithType: (FMLiveSwitchStreamType)  type

Initializes a new instance of the FMLiveSwitchStreamBase class.

Parameters
typeThe type.

◆ tag

- (NSString*) tag

Gets optional data to associate with this instance.

Reimplemented from <FMLiveSwitchIStream>.

◆ transportInfo

- (FMLiveSwitchTransportInfo*) transportInfo

Gets the stream transport info.

Reimplemented from <FMLiveSwitchIStream>.

◆ type

- (FMLiveSwitchStreamType) type

Gets the type.

Reimplemented from <FMLiveSwitchIStream>.