Class SourceFactory
Provides factory methods for creating media sources based on URI schemes and capture devices.
public static class SourceFactory
- Inheritance
-
SourceFactory
- Inherited Members
Methods
Create(string, string, SourceParameters)
Creates a new media source based on the provided URI.
public static IMediaSource Create(string uri, string mimeType = null, SourceParameters parameters = null)
Parameters
uristringThe URI used to determine what kind of source should be created. Can be a local or network file path.
mimeTypestringOptional expected MIME type for HTTP sources. This parameter is only relevant for HTTP URIs.
parametersSourceParametersOptional source configuration parameters, such as decoder/encoder settings.
Returns
- IMediaSource
A media source instance if the protocol is supported; otherwise,
null.
CreateAudioCapture(string, AudioCaptureMode)
Creates or retrieves an existing audio capture source for the specified device.
public static IAudioCaptureSource2 CreateAudioCapture(string deviceId, AudioCaptureMode captureMode = null)
Parameters
deviceIdstringThe identifier of the audio capture device.
captureModeAudioCaptureModeOptional capture mode settings.
Returns
- IAudioCaptureSource2
An audio capture source instance, or
nullif the device ID is invalid.
Remarks
If an active capture source already exists for the specified device, it will be returned instead of creating a new one.
CreateScreenCapture()
Creates a screen capture source for the current platform.
public static IScreenCaptureSource CreateScreenCapture()
Returns
- IScreenCaptureSource
A screen capture source instance, or
nullif screen capture is not supported on the current platform.
CreateVideoCapture(string, VideoCaptureMode)
Creates or retrieves an existing video capture source for the specified device.
public static IVideoCaptureSource2 CreateVideoCapture(string deviceId, VideoCaptureMode captureMode = null)
Parameters
deviceIdstringThe identifier of the video capture device.
captureModeVideoCaptureModeOptional capture mode settings.
Returns
- IVideoCaptureSource2
A video capture source instance, or
nullif the device ID is invalid.
Remarks
If an active capture source already exists for the specified device, it will be returned instead of creating a new one.
GetVideoCapture(string)
Gets an existing video capture source for the specified device.
public static IVideoCaptureSource2 GetVideoCapture(string deviceId)
Parameters
deviceIdstringThe identifier of the video capture device.
Returns
- IVideoCaptureSource2
The video capture source if it exists and is active; otherwise,
null.
Remarks
This method does not create a new capture source if one does not exist. Use CreateVideoCapture(string, VideoCaptureMode) to create a new capture source.