[ type ] VideoDevice
Description:
Represents a video input device, such as WebCam, video capture device, etc. Used when getting input devices with videoInputDevices getter and when setting input device with setInputDevice() method.
Type: Object
Properties:
| Name | Type | Description |
|---|---|---|
|
string | Name of the video input device (only present when retrieving a list of video input devices). |
|
string | ID of the video input device. |
|
Array.<VideoFormat> | List of available video formats (only present when retrieving a list of video input devices). |
|
Chosen video format to use (required when setting a video input device). |
Examples:
Setting a video input device:
const devices = player.videoInputDevices;
console.log(devices[0].formats[0]); // prints first format of a first device
const first_format = devices[0].formats[0];
// create new VideoDevice formatted object
const video_device = {
id: devices[0].id,
format: {
size: first_format.size,
fps: first_format.max_fps,
pixel_format: first_format.pixel_format, // set pixel_format in case when it is used instead of vcodec
vcodec: first_format.vcodec // set vcodec in case when it is used instead of pixel format
}
}
// set the video device and start playing
player.setInputDevice(video_device).play();
