Dev Center
Table of contents

{WebTwainObject}.Addon.Webcam

{WebTwainObject} denotes the WebTwain instance.

Methods

       
CaptureImage() CloseSource() GetCameraControlPropertySetting() GetCameraControlPropertyMoreSetting()
GetVideoPropertySetting() GetVideoPropertyMoreSetting() SetCameraControlPropertySetting() SetVideoPropertySetting()
GetFrameRate() SetFrameRate() GetMediaType() SetMediaType()
GetResolution() SetResolution() GetFramePartURL() GetFrameURL()
GetSourceList() SelectSource() PauseVideo() PlayVideo()
SetVideoRotateMode() StopVideo()    

CaptureImage

Syntax

/**
 * Capture an image from the current camera.
 * @param successCallback A callback function that is executed if the request succeeds.
 * @param failureCallback A callback function that is executed if the request fails.
 * @argument errorCode The error code.
 * @argument errorString The error String
 */
CaptureImage(
    successCallback: () => void,
    failureCallback: (
        errorCode: number,
        errorString: string
    ) => void
): void;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v10.2+ v10.2+ not supported not supported not supported not supported

GetSourceList

Syntax

/**
 * Return a list of all available cameras.
 */
GetSourceList(): string[];

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v10.2+ v10.2+ not supported not supported not supported not supported

SelectSource

Syntax

/**
 * Select a camera to use.
 * @param name Specify the camera.
 */
SelectSource(name: string): boolean;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v10.2+ v10.2+ not supported not supported not supported not supported

CloseSource

Syntax

/**
 * Close the current camera.
 */
CloseSource(): boolean;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v10.2+ v10.2+ not supported not supported not supported not supported

GetSourceList

Syntax

/**
 * Return a list of all available cameras.
 */
GetSourceList(): string[];

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v10.2+ v10.2+ not supported not supported not supported not supported

SelectSource

Syntax

/**
 * Select a camera to use.
 * @param name Specify the camera.
 */
SelectSource(name: string): boolean;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v10.2+ v10.2+ not supported not supported not supported not supported

CloseSource

Syntax

/**
 * Close the current camera.
 */
CloseSource(): boolean;

Usage notes

When you close the camera, the video stream will stop at the last frame.

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v10.2+ v10.2+ not supported not supported not supported not supported

PlayVideo

Syntax

/**
 * Start to play the video stream from the current camera.
 * @param DWObject Specify a WebTwain instance to show the video.
 * @param quality Specify the quality of the video.
 * @param frameDidShow A callback function that is triggered after each video frame is shown.
 */
PlayVideo(
    DWObject: WebTwain,
    quality: number,
    frameDidShow?: function () {}
): boolean;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

PauseVideo

Syntax

/**
 * Pause the video.
 */
PauseVideo(): boolean;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

StopVideo

Syntax

/**
 * Stop the video.
 */
StopVideo(): boolean;

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.

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

GetCameraControlPropertySetting

Syntax

/**
 * Return information about the specified camera property.
 * @param property Specify the property.
 */
GetCameraControlPropertySetting(
    property: Dynamsoft.DWT.EnumDWT_CameraControlProperty | number
): CameraControlProperty;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

GetCameraControlPropertyMoreSetting

Syntax

/**
 * Return detailed information about the specified camera property.
 * @param property Specify the property.
 */
GetCameraControlPropertyMoreSetting(
    property: Dynamsoft.DWT.EnumDWT_CameraControlProperty | number
): CameraControlPropertyExtra;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

SetCameraControlPropertySetting

Syntax

/**
 * Set the specified camera property.
 * @param property Specify the property.
 * @param value Specify the value.
 * @param auto Specify whether the propery should change automatically.
 */
SetCameraControlPropertySetting(
    property: Dynamsoft.DWT.EnumDWT_CameraControlProperty | number,
    value: number,
    auto: boolean
): boolean;

interface CameraControlProperty {
    /**
     * Return the value of the property.
     */
    GetValue(): number;
    /**
     * Return whether the property is set autmatically or not.
     */
    GetIfAuto(): boolean;
}

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;
}

Usage notes

Check out Dynamsoft.DWT.EnumDWT_CameraControlProperty.

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

GetVideoPropertySetting

Syntax

/**
 * Return information about the specified video property.
 * @param property Specify the property.
 */
GetVideoPropertySetting(
    property: Dynamsoft.DWT.EnumDWT_VideoProperty | number
): VideoControlProperty;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

GetVideoPropertyMoreSetting

Syntax

/**
 * Return detailed information about the specified video property.
 * @param property Specify the property.
 */
GetVideoPropertyMoreSetting(
    property: Dynamsoft.DWT.EnumDWT_VideoProperty | number
): VideoControlPropertyExtra;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

SetVideoPropertySetting

Syntax

/**
 * Set the specified video property.
 * @param property Specify the property.
 * @param value Specify the value.
 * @param auto Specify whether the propery should change automatically.
 */
SetVideoPropertySetting(
    property: Dynamsoft.DWT.EnumDWT_VideoProperty | number,
    value: number,
    auto: boolean
): boolean;

interface VideoControlProperty {
    /**
     * Return the value of the property.
     */
    GetValue(): number;
    /**
     * Return whether the property is set autmatically or not.
     */
    GetIfAuto(): boolean;
}

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;
}

Usage notes

Check out Dynamsoft.DWT.EnumDWT_VideoProperty.

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

GetFrameRate

Syntax

/**
 * Return the frame rates supported by the current camera.
 */
GetFrameRate(): FrameRate;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
not supported v14.3.1+ not supported not supported not supported not supported

GetMediaType

Syntax

/**
 * Return the media types supported by the current camera.
 */
GetMediaType(): MediaType;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

GetResolution

Syntax

/**
 * Return the resolutions supported by the current camera.
 */
GetResolution(): Resolution;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

SetFrameRate

Syntax

/**
 * Set the frame rate.
 * @param rate Specify the frame rate.
 */
SetFrameRate(rate: number): boolean;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

SetMediaType

Syntax

/**
 * Set the media type.
 * @param type Sepcify the media type.
 */
SetMediaType(type: string): boolean;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

SetResolution

Syntax

/**
 * Set the resolution.
 * @param resolution Specify the resolution.
 */
SetResolution(resolution: string): boolean;

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;
}

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;
}

interface Resolution {
    /**
     * Return the number of available resolutions.
     */
    GetCount(): number;
    /**
     * Return the specified resolution.
     */
    Get(index: number): string;
    /**
     * Return the current resolution.
     */
    GetCurrent(): string;
}

Example

DWObject.Addon.Webcam.SetResolution("640 x 480");

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

SetVideoRotateMode

Syntax

/**
 * Rotate the video.
 * @param mode Specify the rotate mode
 */
SetVideoRotateMode(
    mode: Dynamsoft.DWT.EnumDWT_VideoRotateMode | number
): boolean;

Usage notes

Check out Dynamsoft.DWT.EnumDWT_VideoRotateMode.

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3+ not supported not supported not supported not supported

GetFrameURL

Syntax

/**
 * Return the URL (http(s)://) for the latest frame.
 */
GetFrameURL(): string;

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
not supported v14.3.1+ not supported not supported not supported not supported

GetFramePartURL

Syntax

/**
 * Return the internal URL (dwt://) for the latest frame.
 */
GetFramePartURL(): string;

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 .

Availability

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v14.3.1+ v14.3.1+ not supported not supported not supported not supported

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest Version
  • Version 17.1.1
  • Version 17.0
  • Version 16.2
  • Version 16.1.1
Change +
© 2003–2022 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support