Addon.Webcam.CaptureImage()

Description

Captures an image from the webcam. This is an asynchronous method.

Syntax

.Addon.Webcam.CaptureImage(bool bIfShowUI, OnCaptureStart, OnCaptureSuccess, OnCaptureError, OnCaptureEnd);

Parameters

<bool> bIfShowUI: If it is true, the webcam UI will show where presettings can be made before capturing; otherwise, the UI won't show and the capturing starts right away.

<function> OnCaptureStart: Invoked when the capturing begins.
<function> OnCaptureSuccess: Invoked when one image is successfully captured.
<function> OnCaptureError(errorCode, errorString):Invoked when the operation fails. You can check why it failed with the returned errorCode or errorString.
<function> OnCaptureEnd: Invoked when capturing ends.

Return value

void

Example

function CaptureImage() {
    if (DWObject) {
      DWObject.Addon.Webcam.SelectSource(document.getElementById(&amp;quot;source&amp;quot;).options[
      document.getElementById(&amp;quot;source&amp;quot;).selectedIndex].text);

        var showUI = document.getElementById(&amp;quot;ShowUI&amp;quot;).checked;

        var OnCaptureStart = function () {}

        var OnCaptureSuccess = function () {}

        var OnCaptureError = function (error, errorstr) {alert(errorstr); }

        var OnCaptureEnd = function () {}

      DWObject.Addon.Webcam.CaptureImage(showUI, OnCaptureStart, OnCaptureSuccess, OnCaptureError, OnCaptureEnd);
    }
}

See Also

Addon.Webcam.CloseSource()

Is this page helpful?

Leave a Reply

Your email address will not be published.