{WebTwainObject}.Addon.Webcam
{WebTwainObject} denotes the
WebTwain
instance.
Methods
CaptureImage
Capture an image from the current camera.
Syntax
CaptureImage(
successCallback: () => void,
failureCallback: (errorCode: number, errorString: string) => void
): void;
Parameters
successCallback
: A callback function that is executed if the request succeeds.
failureCallback
: A callback function that is executed if the request fails.
errorCode
: The error code.errorString
: The error String
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v10.2+ | v10.2+ | not supported | not supported | not supported |
GetSourceList
Return a list of all available cameras.
Syntax
GetSourceList(): string[];
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v10.2+ | v10.2+ | not supported | not supported | not supported |
SelectSource
Select a camera to use.
Syntax
SelectSource(name: string): boolean;
Parameters
name
: Specify the camera.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v10.2+ | v10.2+ | not supported | not supported | not supported |
CloseSource
Close the current camera.
Syntax
CloseSource(): boolean;
Usage notes
When you close the camera, the video stream will stop at the last frame.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v10.2+ | v10.2+ | not supported | not supported | not supported |
PlayVideo
Start to play the video stream from the current camera.
Syntax
PlayVideo(
DWObject: WebTwain,
quality: number,
frameDidShow?: function () {}
): boolean;
Parameters
DWObject
: Specify a WebTwain instance to show the video.
quality
: Specify the quality of the video.
frameDidShow
: A callback function that is triggered after each video frame is shown.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
PauseVideo
Pause the video.
Syntax
PauseVideo(): boolean;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
StopVideo
Stop the video.
Syntax
StopVideo(): boolean;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
Usage notes
When you capture a frame, it’s always the actual latest frame from the camera even if you have paused the video.
When you close the camera, the video stream will stop at the last frame.
GetCameraControlPropertySetting
Return information about the specified camera property.
Syntax
GetCameraControlPropertySetting(
property: Dynamsoft.DWT.EnumDWT_CameraControlProperty | number
): CameraControlProperty;
interface CameraControlProperty {
/**
* Return the value of the property.
*/
GetValue(): number;
/**
* Return whether the property is set autmatically or not.
*/
GetIfAuto(): boolean;
}
Parameters
property
: Specify the property. Please refer to EnumDWT_CameraControlProperty.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
GetCameraControlPropertyMoreSetting
Return detailed information about the specified camera property.
Syntax
GetCameraControlPropertyMoreSetting(
property: Dynamsoft.DWT.EnumDWT_CameraControlProperty | number
): CameraControlPropertyExtra;
interface CameraControlPropertyExtra {
/**
* Return the minimum value of the property.
*/
GetMinValue(): number;
/**
* Return the maximum value of the property.
*/
GetMaxValue(): number;
/**
* Return the default value of the property.
*/
GetDefaultValue(): number;
/**
* Return the smallest increment by which the property can change.
*/
GetSteppingDelta(): number;
/**
* Return whether the property is set autmatically or not.
*/
GetIfAuto(): boolean;
}
Parameters
property
: Specify the property. Please refer to EnumDWT_CameraControlProperty.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
SetCameraControlPropertySetting
Set the specified camera property.
Syntax
SetCameraControlPropertySetting(
property: Dynamsoft.DWT.EnumDWT_CameraControlProperty | number,
value: number,
auto: boolean
): boolean;
Parameters
property
: Specify the property. Please refer to EnumDWT_CameraControlProperty.
value
: Specify the value.
auto
: Specify whether the propery should change automatically.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
GetVideoPropertySetting
Return information about the specified video property.
Syntax
GetVideoPropertySetting(
property: Dynamsoft.DWT.EnumDWT_VideoProperty | number
): VideoControlProperty;
interface VideoControlProperty {
/**
* Return the value of the property.
*/
GetValue(): number;
/**
* Return whether the property is set autmatically or not.
*/
GetIfAuto(): boolean;
}
Parameters
property
: Specify the property. Please refer to EnumDWT_VideoProperty.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
GetVideoPropertyMoreSetting
Return detailed information about the specified video property.
Syntax
GetVideoPropertyMoreSetting(
property: Dynamsoft.DWT.EnumDWT_VideoProperty | number
): VideoControlPropertyExtra;
interface VideoControlPropertyExtra {
/**
* Return the minimum value of the property.
*/
GetMinValue(): number;
/**
* Return the maximum value of the property.
*/
GetMaxValue(): number;
/**
* Return the default value of the property.
*/
GetDefaultValue(): number;
/**
* Return the smallest increment by which the property can change.
*/
GetSteppingDelta(): number;
/**
* Return whether the property is set autmatically or not.
*/
GetIfAuto(): boolean;
}
Parameters
property
: Specify the property. Please refer to EnumDWT_VideoProperty.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
SetVideoPropertySetting
Set the specified video property.
Syntax
SetVideoPropertySetting(
property: Dynamsoft.DWT.EnumDWT_VideoProperty | number,
value: number,
auto: boolean
): boolean;
Parameters
property
: Specify the property. Please refer to EnumDWT_VideoProperty.
value
: Specify the value.
auto
: Specify whether the propery should change automatically.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
GetFrameRate
Return the frame rates supported by the current camera.
Syntax
GetFrameRate(): FrameRate;
interface FrameRate {
/**
* Return the number of available frame rates.
*/
GetCount(): number;
/**
* Return the specified frame rate.
*/
Get(index: number): number;
/**
* Return the current frame rate.
*/
GetCurrent(): number;
}
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
not supported | v14.3.1+ | not supported | not supported | not supported |
GetMediaType
Return the media types supported by the current camera.
Syntax
GetMediaType(): MediaType;
interface MediaType {
/**
* Return the number of available media types.
*/
GetCount(): number;
/**
* Return the specified media type.
*/
Get(index: number): string;
/**
* Return the current media type.
*/
GetCurrent(): string;
}
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
GetResolution
Return the resolutions supported by the current camera.
Syntax
GetResolution(): Resolution;
interface Resolution {
/**
* Return the number of available resolutions.
*/
GetCount(): number;
/**
* Return the specified resolution.
*/
Get(index: number): string;
/**
* Return the current resolution.
*/
GetCurrent(): string;
}
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
SetFrameRate
Set the frame rate.
Syntax
SetFrameRate(rate: number): boolean;
Parameters
rate
: Specify the frame rate.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
SetMediaType
Set the media type.
Syntax
SetMediaType(type: string): boolean;
Parameters
type
: Sepcify the media type.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
SetResolution
Set the resolution.
Syntax
SetResolution(resolution: string): boolean;
Parameters
resolution
: Specify the resolution.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
Example
DWObject.Addon.Webcam.SetResolution("640 x 480");
SetVideoRotateMode
Rotate the video.
Syntax
SetVideoRotateMode(
mode: Dynamsoft.DWT.EnumDWT_VideoRotateMode | number
): boolean;
Parameters
mode
: Specify the rotate mode. Please refer to EnumDWT_VideoRotateMode.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3+ | not supported | not supported | not supported |
GetFrameURL
Return the URL (http(s)://) for the latest frame.
Syntax
GetFrameURL(): string;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
not supported | v14.3.1+ | not supported | not supported | not supported |
GetFramePartURL
Return the internal URL (dwt://) for the latest frame.
Syntax
GetFramePartURL(): string;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v14.3.1+ | v14.3.1+ | not supported | not supported | not supported |
Usage notes
GetFrameURL()
returns a public URL that can be used to access the frame directly by any applicatoin capable of HTTP requests that runs on the same machine. For example: https://127.0.0.1:18623/dwt/dwt_16000428/img?id=853407158&index=-1&width=-1&height=-1&webcam=80&t=1590481406860
.
GetFramePartURL()
returns an internal URL that only Dynamsoft libraries such as the Barcode Reader add-on can read. For example: dwt://dwt_16000428/img?id=853407158&index=-1&width=-1&height=-1&webcam=80&t=1590481403659
.