Class LocalMedia
A collection of local audio/video tracks.
Inheritance
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class LocalMedia : LocalMediaBase<LocalMedia, AudioTrack, VideoTrack>, ILocalMedia<LocalMedia, AudioTrack, VideoTrack>, IMedia<AudioTrack, VideoTrack>
Properties
AudioSource
Gets the audio source.
Declaration
public AudioSource AudioSource { get; }
Property Value
Type | Description |
---|---|
AudioSource |
AudioSourceInput
Gets or sets the current audio source input of the audio track.
If there are multiple audio tracks in a custom media stack, this property is bound to the first audio track.
The audio source input can only be set before the media has started. If the audio source input is not set, then the default input device is used.
If you want to change the input after the media has started, call ChangeAudioSourceInput instead. ChangeAudioSourceInput stops the current audio input and switch to the new input.
Declaration
public SourceInput AudioSourceInput { get; set; }
Property Value
Type | Description |
---|---|
SourceInput |
AudioSources
Gets the audio sources.
Declaration
public AudioSource[] AudioSources { get; }
Property Value
Type | Description |
---|---|
AudioSource[] |
MediaSources
Gets the audio/video sources.
Declaration
public MediaSourceBase[] MediaSources { get; }
Property Value
Type | Description |
---|---|
MediaSourceBase[] |
VideoSource
Gets the video source.
Declaration
public VideoSource VideoSource { get; }
Property Value
Type | Description |
---|---|
VideoSource |
VideoSourceInput
Gets or sets the current video source input of the video track.
If there are multiple video tracks in a custom media stack, this property is bound to the first video track.
The video source input can only be set before the media has started. If the video source input is not set, then the default input device is used.
If you want to change the input after the media has started, call ChangeVideoSourceInput instead. ChangeVideoSourceInput stops the current audio input and switch to the new input.
Declaration
public SourceInput VideoSourceInput { get; set; }
Property Value
Type | Description |
---|---|
SourceInput |
VideoSources
Gets the video sources.
Declaration
public VideoSource[] VideoSources { get; }
Property Value
Type | Description |
---|---|
VideoSource[] |
Methods
AddAudioTrack(AudioTrack)
Adds the audio track.
Declaration
protected override void AddAudioTrack(AudioTrack audioTrack)
Parameters
Type | Name | Description |
---|---|---|
AudioTrack | audioTrack | The audio track. |
Overrides
AddVideoTrack(VideoTrack)
Adds the video track.
Declaration
protected override void AddVideoTrack(VideoTrack videoTrack)
Parameters
Type | Name | Description |
---|---|---|
VideoTrack | videoTrack | The video track. |
Overrides
ArrayFromAudioTracks(List<AudioTrack>)
Creates an array of tracks from a list of audio tracks.
Declaration
protected override AudioTrack[] ArrayFromAudioTracks(List<AudioTrack> tracks)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<AudioTrack> | tracks | The list of tracks. |
Returns
Type | Description |
---|---|
AudioTrack[] |
Overrides
ArrayFromVideoTracks(List<VideoTrack>)
Creates an array of tracks from a list of video tracks.
Declaration
protected override VideoTrack[] ArrayFromVideoTracks(List<VideoTrack> tracks)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<VideoTrack> | tracks | The list of tracks. |
Returns
Type | Description |
---|---|
VideoTrack[] |
Overrides
ChangeAudioSourceInput(SourceInput)
Changes the audio source input of the audio track while the media is active. If there are multiple audio tracks in a custom media stack, this method calls into the first audio track.
For example, this method can be used to change the audio source's input on a laptop from the device microphone to a USB headset.
Declaration
public Future<object> ChangeAudioSourceInput(SourceInput audioSourceInput)
Parameters
Type | Name | Description |
---|---|---|
SourceInput | audioSourceInput | The audio source input. |
Returns
Type | Description |
---|---|
Future<System.Object> |
ChangeVideoSourceInput(SourceInput)
Changes the video source input of the video track while the media is active. If there are multiple video tracks in a custom media stack, this method calls into the first video track.
For example, this method can be used to change the video source’s input on a mobile device from a front to a back camera.
Declaration
public Future<object> ChangeVideoSourceInput(SourceInput videoSourceInput)
Parameters
Type | Name | Description |
---|---|---|
SourceInput | videoSourceInput | The video source input. |
Returns
Type | Description |
---|---|
Future<System.Object> |
CreateAudioTrackCollection()
Creates an audio track collection.
Declaration
protected override List<AudioTrack> CreateAudioTrackCollection()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<AudioTrack> |
Overrides
CreateVideoTrackCollection()
Creates a video track collection.
Declaration
protected override List<VideoTrack> CreateVideoTrackCollection()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<VideoTrack> |
Overrides
DoGetAudioEncodings()
Gets the array of local audio encoding configurations.
Declaration
protected override AudioEncodingConfig[] DoGetAudioEncodings()
Returns
Type | Description |
---|---|
AudioEncodingConfig[] | The local audio encodings. |
Overrides
DoGetVideoEncodings()
Gets the local video encodings.
Declaration
protected override VideoEncodingConfig[] DoGetVideoEncodings()
Returns
Type | Description |
---|---|
VideoEncodingConfig[] | The local video encodings. |
Overrides
DoSetAudioEncodings(AudioEncodingConfig[])
Sets the local audio encodings.
Declaration
protected override void DoSetAudioEncodings(AudioEncodingConfig[] encodings)
Parameters
Type | Name | Description |
---|---|---|
AudioEncodingConfig[] | encodings | The local audio encodings. |
Overrides
DoSetVideoEncodings(VideoEncodingConfig[])
Sets the local video encodings.
Declaration
protected override void DoSetVideoEncodings(VideoEncodingConfig[] encodings)
Parameters
Type | Name | Description |
---|---|---|
VideoEncodingConfig[] | encodings | The local video encodings. |
Overrides
DoStart()
Starts the local media.
Declaration
protected override Future<LocalMedia> DoStart()
Returns
Type | Description |
---|---|
Future<LocalMedia> |
Overrides
DoStop()
Stops the local media.
Declaration
protected override Future<LocalMedia> DoStop()
Returns
Type | Description |
---|---|
Future<LocalMedia> |
Overrides
GetAudioSourceInputs()
Gets a list of the names and IDs of currently available audio devices.
A common requirement when working with LiveSwitch is to present a list of available media devices for the user to select from. Additionally, you might want to store the selected devices for retrieval. For example, to select the device again if the user leaves and returns.
Declaration
public Future<SourceInput[]> GetAudioSourceInputs()
Returns
Type | Description |
---|---|
Future<SourceInput[]> | A future with an array of audio source inputs. |
GetVideoSourceInputs()
Gets a list of the names and IDs of currently available video devices.
A common requirement when working with LiveSwitch is to present a list of available media devices for the user to select from. Additionally, you might want to store the selected devices for retrieval. For example, to select the device again if the user leaves and returns.
Declaration
public Future<SourceInput[]> GetVideoSourceInputs()
Returns
Type | Description |
---|---|
Future<SourceInput[]> | A future with an array of video source inputs. |
RemoveAudioTrack(AudioTrack)
Removes the audio track.
Declaration
protected override bool RemoveAudioTrack(AudioTrack audioTrack)
Parameters
Type | Name | Description |
---|---|---|
AudioTrack | audioTrack | The audio track. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
RemoveVideoTrack(VideoTrack)
Removes the video track.
Declaration
protected override bool RemoveVideoTrack(VideoTrack videoTrack)
Parameters
Type | Name | Description |
---|---|---|
VideoTrack | videoTrack | The video track. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Events
OnAudioMuted
Raised when the audio source is muted.
Declaration
public event Action0 OnAudioMuted
Event Type
Type | Description |
---|---|
Action0 |
OnAudioStarted
Raised when the first audio track is started.
Declaration
public event Action0 OnAudioStarted
Event Type
Type | Description |
---|---|
Action0 |
OnAudioStopped
Raised when the first audio track is stopped.
Declaration
public event Action0 OnAudioStopped
Event Type
Type | Description |
---|---|
Action0 |
OnAudioUnmuted
Raised when the audio source is unmuted.
Declaration
public event Action0 OnAudioUnmuted
Event Type
Type | Description |
---|---|
Action0 |
OnVideoMuted
Raised when the video source is muted.
Declaration
public event Action0 OnVideoMuted
Event Type
Type | Description |
---|---|
Action0 |
OnVideoStarted
Raised when the first video track is started.
Declaration
public event Action0 OnVideoStarted
Event Type
Type | Description |
---|---|
Action0 |
OnVideoStopped
Raised when the first video track is stopped.
Declaration
public event Action0 OnVideoStopped
Event Type
Type | Description |
---|---|
Action0 |
OnVideoUnmuted
Raised when the video source is unmuted.
Declaration
public event Action0 OnVideoUnmuted
Event Type
Type | Description |
---|---|
Action0 |