MLCameraVideoSource
Demonstrates using the MLCamera as an app defined video source.
Inherits from:
AppDefinedVideoSource,
AppDefinedSource,
Track
Public Methods
delegate void CaptureStatusChangedDelegate
public delegate void CaptureStatusChangedDelegate(
bool isDestroying
)
Parameters
Type | Name | Description |
---|---|---|
bool | isDestroying |
MLCameraVideoSource CreateLocal
Developer should've created the MLCamera object, queried the stream capabilities, selected one & populated a MLCamera.CaptureConfig object with it. Developers are NOT required to setup any native surface in the capture config. The CaptureConfig should contain at a minimum a StreamConfig with CaptureType Video in the first array position, and optionally a second StreamConfig with CaptureType Preview if the call app wishes to display camera preview. Developer should NOT have called MLCamera.PrepareCapture() or any other capture functions on the camera object.
public static MLCameraVideoSource CreateLocal(
MLCameraBase camera,
MLCamera.CaptureConfig captureConfig,
out MLResult result,
string trackId ="",
Renderer localRenderer =null,
bool nativeBuffers =true,
bool handlePause =true
)
Parameters
Type | Name | Description |
---|---|---|
MLCameraBase | camera | The MLCamera used to provide the video source for the Track. |
MLCamera.CaptureConfig | captureConfig | The CaptureConfig should be configured prior to calling. The StreamConfigs array must contain a StreamConfig with CaptureType Video at index 0 and optionally a second with CaptureType Preview to enable rendering the MLCamera.PreviewTexture |
out MLResult | result | The MLResult generated by attempting to initialize this AppDefinedVideoSource. |
string | trackId | An optional track ID |
Renderer | localRenderer | Optional Unity Renderer component configured in the scene to display the MLCamera.PreviewTexture. |
bool | nativeBuffers | |
bool | handlePause |
Returns:
MLCameraVideoSource
public MLCameraVideoSource(
string trackId
)
Parameters
Type | Name | Description |
---|---|---|
string | trackId |
Protected Methods
OnApplicationPause
Reacts to when the application is paused (after subscribing to MLDevice). Override for custom behavior.
protected virtual override void OnApplicationPause(
bool pause
)
Parameters
Type | Name | Description |
---|---|---|
bool | pause | True if paused. |
Reimplements: OnApplicationPause
OnSourceDestroy
Instance method that is called when the source is destroyed via MLWebRTC.MediaStream.Track.DestroyLocal() .
protected virtual override void OnSourceDestroy()
Reimplements: OnSourceDestroy
OnSourceSetEnabled
Instance method that is called when the source is enabled or disabled via MLWebRTC.MediaStream.Track.SetEnabled()
protected virtual override void OnSourceSetEnabled(
bool enabled
)
Parameters
Type | Name | Description |
---|---|---|
bool | enabled | True if enabled. |
Reimplements: OnSourceSetEnabled
Public Attributes
IsCapturing
public bool IsCapturing => isCapturing;
Public Events
OnCaptureStatusChanged
public CaptureStatusChangedDelegate OnCaptureStatusChanged()