Thanks for Downloading Dynamic Web TWAIN 30-Day Trial!
Your download will start shortly. If your download does not begin, click here to retry.
{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(
DWTObject: WebTwain,
quality: number,
frameDidShow?: function () {}
): boolean;
Parameters
DWTObject
: 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. Please refer to CameraControlProperty
.
Syntax
GetCameraControlPropertySetting(
property: Dynamsoft.DWT.EnumDWT_CameraControlProperty | number
): CameraControlProperty;
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. Please refer to CameraControlPropertyExtra
.
Syntax
GetCameraControlPropertyMoreSetting(
property: Dynamsoft.DWT.EnumDWT_CameraControlProperty | number
): CameraControlPropertyExtra;
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. Please refer to VideoControlProperty
.
Syntax
GetVideoPropertySetting(
property: Dynamsoft.DWT.EnumDWT_VideoProperty | number
): VideoControlProperty;
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. Please refer to VideoControlPropertyExtra
.
Syntax
GetVideoPropertyMoreSetting(
property: Dynamsoft.DWT.EnumDWT_VideoProperty | number
): VideoControlPropertyExtra;
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. Please refer to FrameRate
.
Syntax
GetFrameRate(): FrameRate;
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. Please refer to MediaType
.
Syntax
GetMediaType(): MediaType;
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. Please refer to Resolution
.
Syntax
GetResolution(): Resolution;
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
DWTObject.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
.