Unity WebcamSource
component
The WebcamSource
Unity component represents a single video track source generating video frames captured from a local video capture device (webcam).
Properties
Video capture
WebcamDevice
(code only)
Description of the video capture device to use, colloquially referred to as webcam for short, even if other non-webcam capture devices are also supported, like the HoloLens 1 and HoloLens 2 cameras. Valid device unique identifiers can be enumerated with DeviceVideoTrackSource.GetCaptureFormatsAsync()
and correspond to the VideoCaptureDevice.id
field. Note that this property is not exposed to the Unity editor, as devices should be enumerate at runtime to support the various video capture device configurations of the host device.
FormatMode
("Capture format" in Inspector)
Select between automated and manual video capture format selection mode. In automated mode, the implementation selects the best video capture format. In manual mode, some constraints can be specified to restrict the video capture formats the implementation might consider using, and even force one particular format.
Constraints
(code only)
Optional resolution and framerate constraints to apply when selecting a video capture format. This allows restricting the set of capture formats the implementation considers when selecting a capture format to use, possibly even forcing a single one. Constraints reducing the number of matching capture formats to zero will make opening the device fail, therefore it is recommended to enumerate the supported capture formats with DeviceVideoTrackSource.GetCaptureFormatsAsync
.
VideoProfileId
(code only)
[UWP only] Optional unique identifier of the video profile to use to enumerate the video capture formats. This allows selecting a video profile other than the default one, which sometimes enables access to other resolutions and framerates, and is required on HoloLens 2 to use the low-power capture formats. It is recommended to specify either VideoProfileId
or VideoProfileKind
, but not both.
VideoProfileKind
(code only)
[UWP only] Optional video profile kind to use to enumerate the video capture formats. This allows selecting a video profile other than the default one, which sometimes enables access to other resolutions and framerates, and is required on HoloLens 2 to use the low-power capture formats. It is recommended to specify either VideoProfileId
or VideoProfileKind
, but not both.
EnableMixedRealityCapture
[UWP only] On platforms supporting Mixed Reality Capture (MRC) like HoloLens 1st generation and 2nd generation, instruct the video capture module to enable this feature and produce a video stream containing the holograms rendered over the raw webcam feed. This has no effect if the local device does not support MRC.
EnableMRCRecordingIndicator
[UWP only] On platforms supporting Mixed Reality Capture (MRC) like HoloLens 1st generation and 2nd generation, and when EnableMixedRealityCapture
is true
, enable the on-screen recording indicator (red circle) on the device while the camera is capturing.
VideoStreamStarted
Event raised when the video track source starts capturing frames.
VideoStreamStopped
Event raised when the video track source stops capturing frames.