FMLiveSwitchMedia Class Reference

A collection of audio/video tracks. More...

Instance Methods

(void) - addAudioTrack:
 Adds an audio track. More...
 
(void) - addOnAudioDestroyed:
 Adds a handler that is raised when the audio track is destroyed. More...
 
(void) - addOnAudioLevel:
 Adds a handler that is raised periodically when the audio's level is calculated. More...
 
(double) - addOnAudioLevelWithBlock
 Adds a handler that is raised periodically when the audio's level is calculated. More...
 
(void) - addOnAudioLevelWithBlock:
 Adds a handler that is raised periodically when the audio's level is calculated. More...
 
(void) - addOnVideoDestroyed:
 Adds a handler that is raised when the video track is destroyed. More...
 
(void) - addOnVideoSize:
 Adds a handler that is raised whenever the video's frame size is known, once per frame. More...
 
(void) - addOnVideoSizeChange:
 Adds a handler that is raised whenever the video's frame size changes. More...
 
(FMLiveSwitchSize *) - addOnVideoSizeChangeWithBlock
 Adds a handler that is raised whenever the video's frame size changes. More...
 
(void) - addOnVideoSizeChangeWithBlock:
 Adds a handler that is raised whenever the video's frame size changes. More...
 
(FMLiveSwitchSize *) - addOnVideoSizeWithBlock
 Adds a handler that is raised whenever the video's frame size is known, once per frame. More...
 
(void) - addOnVideoSizeWithBlock:
 Adds a handler that is raised whenever the video's frame size is known, once per frame. More...
 
(void) - addVideoTrack:
 Adds a video track. More...
 
(NSMutableArray *) - arrayFromAudioTracks:
 Creates an array of tracks from a list of audio tracks. More...
 
(NSMutableArray *) - arrayFromVideoTracks:
 Creates an array of tracks from a list of video tracks. More...
 
(int) - audioLevelInterval
 Gets the interval in milliseconds between FMLiveSwitchMedia`2addOnAudioLevel: events. More...
 
(NSMutableArray *) - audioTracks
 Gets all audio tracks from this media. More...
 
(NSMutableArray< TAudioTrack > *) - createAudioTrackCollection
 Creates an audio track collection. More...
 
(NSMutableArray< TVideoTrack > *) - createVideoTrackCollection
 Creates a video track collection. More...
 
(void) - destroy
 Destroys all non-persistent internal objects encapsulated by the Media class. More...
 
(FMLiveSwitchFuture< FMLiveSwitchVideoBuffer * > *) - grabVideoFrame
 Gets the next frame from the video track once it is rendered. More...
 
(instancetype) - init
 Initializes a new instance of the FMLiveSwitchMedia`2 class. More...
 
(bool) - isRecordingAudio
 Gets whether audio is being recorded locally. More...
 
(bool) - isRecordingVideo
 Gets whether video is being recorded locally. More...
 
(bool) - removeAudioTrack:
 Removes an audio track. More...
 
(void) - removeOnAudioDestroyed:
 Removes a handler that is raised when the audio track is destroyed. More...
 
(void) - removeOnAudioLevel:
 Removes a handler that is raised periodically when the audio's level is calculated. More...
 
(void) - removeOnVideoDestroyed:
 Removes a handler that is raised when the video track is destroyed. More...
 
(void) - removeOnVideoSize:
 Removes a handler that is raised whenever the video's frame size is known, once per frame. More...
 
(void) - removeOnVideoSizeChange:
 Removes a handler that is raised whenever the video's frame size changes. More...
 
(bool) - removeVideoTrack:
 Removes a video track. More...
 
(void) - setAudioLevelInterval:
 Sets the interval in milliseconds between FMLiveSwitchMedia`2addOnAudioLevel: events. More...
 
(void) - setIsRecordingAudio:
 Sets whether audio is being recorded locally. More...
 
(void) - setIsRecordingVideo:
 Sets whether video is being recorded locally. More...
 
(FMLiveSwitchSize *) - videoSize
 Gets the size of the video track. More...
 
(NSMutableArray *) - videoTracks
 Gets all video tracks from this media. More...
 

Class Methods

(FMLiveSwitchMedia *) + media
 Initializes a new instance of the FMLiveSwitchMedia`2 class. More...
 

Protected Attributes

 __pad0__: FMLiveSwitchMediaBase<TAudioTrack
 

Detailed Description

A collection of audio/video tracks.

Method Documentation

◆ addAudioTrack:

- (void) addAudioTrack: (TAudioTrack)  audioTrack

Adds an audio track.

Parameters
audioTrackThe audio track.

◆ addOnAudioDestroyed:

- (void) addOnAudioDestroyed: (FMLiveSwitchAction0 *)  value

Adds a handler that is raised when the audio track is destroyed.


If there are multiple audio tracks in a custom media stack, only the first audio track triggers this event.

◆ addOnAudioLevel:

- (void) addOnAudioLevel: (FMLiveSwitchAction1< id > *)  value

Adds a handler that is raised periodically when the audio's level is calculated.


When the media is in the Started state, the function runs multiple times per second. The frequency depends on the audio sampling rate.
Use this method to determine which audio streams are active.
If there are multiple audio tracks in a custom media stack, only the first audio track triggers this event.

◆ addOnAudioLevelWithBlock

- (double) addOnAudioLevelWithBlock

Adds a handler that is raised periodically when the audio's level is calculated.


When the media is in the Started state, the function runs multiple times per second. The frequency depends on the audio sampling rate.
Use this method to determine which audio streams are active.
If there are multiple audio tracks in a custom media stack, only the first audio track triggers this event.

◆ addOnAudioLevelWithBlock:

- (void) addOnAudioLevelWithBlock: (void(^)(double))  valueBlock

Adds a handler that is raised periodically when the audio's level is calculated.


When the media is in the Started state, the function runs multiple times per second. The frequency depends on the audio sampling rate.
Use this method to determine which audio streams are active.
If there are multiple audio tracks in a custom media stack, only the first audio track triggers this event.

◆ addOnVideoDestroyed:

- (void) addOnVideoDestroyed: (FMLiveSwitchAction0 *)  value

Adds a handler that is raised when the video track is destroyed.


If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

◆ addOnVideoSize:

- (void) addOnVideoSize: (FMLiveSwitchAction1< FMLiveSwitchSize * > *)  value

Adds a handler that is raised whenever the video's frame size is known, once per frame.


If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

◆ addOnVideoSizeChange:

- (void) addOnVideoSizeChange: (FMLiveSwitchAction1< FMLiveSwitchSize * > *)  value

Adds a handler that is raised whenever the video's frame size changes.


If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

◆ addOnVideoSizeChangeWithBlock

- (FMLiveSwitchSize*) addOnVideoSizeChangeWithBlock

Adds a handler that is raised whenever the video's frame size changes.


If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

◆ addOnVideoSizeChangeWithBlock:

- (void) addOnVideoSizeChangeWithBlock: (void(^)(FMLiveSwitchSize *))  valueBlock

Adds a handler that is raised whenever the video's frame size changes.


If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

◆ addOnVideoSizeWithBlock

- (FMLiveSwitchSize*) addOnVideoSizeWithBlock

Adds a handler that is raised whenever the video's frame size is known, once per frame.


If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

◆ addOnVideoSizeWithBlock:

- (void) addOnVideoSizeWithBlock: (void(^)(FMLiveSwitchSize *))  valueBlock

Adds a handler that is raised whenever the video's frame size is known, once per frame.


If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

◆ addVideoTrack:

- (void) addVideoTrack: (TVideoTrack)  videoTrack

Adds a video track.

Parameters
videoTrackThe video track.

◆ arrayFromAudioTracks:

- (NSMutableArray*) arrayFromAudioTracks: (NSMutableArray< TAudioTrack > *)  tracks

Creates an array of tracks from a list of audio tracks.

Parameters
tracksThe list of tracks.

◆ arrayFromVideoTracks:

- (NSMutableArray*) arrayFromVideoTracks: (NSMutableArray< TVideoTrack > *)  tracks

Creates an array of tracks from a list of video tracks.

Parameters
tracksThe list of tracks.

◆ audioLevelInterval

- (int) audioLevelInterval

Gets the interval in milliseconds between FMLiveSwitchMedia`2addOnAudioLevel: events.

Defaults to 200.

◆ audioTracks

- (NSMutableArray*) audioTracks

Gets all audio tracks from this media.

◆ createAudioTrackCollection

- (NSMutableArray<TAudioTrack>*) createAudioTrackCollection

Creates an audio track collection.

Implemented in FMLiveSwitchRemoteMedia.

◆ createVideoTrackCollection

- (NSMutableArray<TVideoTrack>*) createVideoTrackCollection

Creates a video track collection.

Implemented in FMLiveSwitchRemoteMedia.

◆ destroy

- (void) destroy

Destroys all non-persistent internal objects encapsulated by the Media class.


This method iterates over all audio and video tracks and calls each track's Destroy method for non-persistent tracks.

◆ grabVideoFrame

Gets the next frame from the video track once it is rendered.


If there are multiple video tracks in a custom media stack, this method calls into the first video track.
This method could be used for asynchronous video processing or analysis.

Returns
A future video buffer.

◆ init

- (instancetype) init

Initializes a new instance of the FMLiveSwitchMedia`2 class.

Implemented in FMLiveSwitchRemoteMedia.

◆ isRecordingAudio

- (bool) isRecordingAudio

Gets whether audio is being recorded locally.

◆ isRecordingVideo

- (bool) isRecordingVideo

Gets whether video is being recorded locally.

◆ media

+ (FMLiveSwitchMedia*) media

Initializes a new instance of the FMLiveSwitchMedia`2 class.

◆ removeAudioTrack:

- (bool) removeAudioTrack: (TAudioTrack)  audioTrack

Removes an audio track.

Parameters
audioTrackThe audio track.

◆ removeOnAudioDestroyed:

- (void) removeOnAudioDestroyed: (FMLiveSwitchAction0 *)  value

Removes a handler that is raised when the audio track is destroyed.


If there are multiple audio tracks in a custom media stack, only the first audio track triggers this event.

◆ removeOnAudioLevel:

- (void) removeOnAudioLevel: (FMLiveSwitchAction1< id > *)  value

Removes a handler that is raised periodically when the audio's level is calculated.


When the media is in the Started state, the function runs multiple times per second. The frequency depends on the audio sampling rate.
Use this method to determine which audio streams are active.
If there are multiple audio tracks in a custom media stack, only the first audio track triggers this event.

◆ removeOnVideoDestroyed:

- (void) removeOnVideoDestroyed: (FMLiveSwitchAction0 *)  value

Removes a handler that is raised when the video track is destroyed.


If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

◆ removeOnVideoSize:

- (void) removeOnVideoSize: (FMLiveSwitchAction1< FMLiveSwitchSize * > *)  value

Removes a handler that is raised whenever the video's frame size is known, once per frame.


If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

◆ removeOnVideoSizeChange:

- (void) removeOnVideoSizeChange: (FMLiveSwitchAction1< FMLiveSwitchSize * > *)  value

Removes a handler that is raised whenever the video's frame size changes.


If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

◆ removeVideoTrack:

- (bool) removeVideoTrack: (TVideoTrack)  videoTrack

Removes a video track.

Parameters
videoTrackThe video track.

◆ setAudioLevelInterval:

- (void) setAudioLevelInterval: (int)  value

Sets the interval in milliseconds between FMLiveSwitchMedia`2addOnAudioLevel: events.

Defaults to 200.

◆ setIsRecordingAudio:

- (void) setIsRecordingAudio: (bool)  value

Sets whether audio is being recorded locally.

◆ setIsRecordingVideo:

- (void) setIsRecordingVideo: (bool)  value

Sets whether video is being recorded locally.

◆ videoSize

- (FMLiveSwitchSize*) videoSize

Gets the size of the video track.


If there are multiple video tracks in a custom media stack, this property is bound to the first video track.
If you need to adjust a UI’s layout, use this property to check video dimensions. You can also use OnVideoSize to ensure that the code is responsive.

◆ videoTracks

- (NSMutableArray*) videoTracks

Gets all video tracks from this media.

Member Data Documentation

◆ __pad0__

- __pad0__
protected