JavaScript API Reference
Methods and Properties
Initialization
| Name | Description |
|---|---|
| createInstance() | Creates a CameraEnhancer instance. |
| defaultUIElementURL | Returns or sets the URL of the .html file that defines the default UI Element. |
| getUIElement() | Returns the HTML element that is used by the CameraEnhancer instance. |
| setUIElement() | Specifies an HTML element for the CameraEnhancer instance to use as its UI element. |
Camera Control
| Name | Description |
|---|---|
| ifSkipCameraInspection | Returns or sets whether to skip camera inspection at initialization to save time. |
| ifSaveLastUsedCamera | Returns or sets whether to save the last used camera and resolution. |
| getAllCameras() | Returns infomation of all available cameras on the device. |
| selectCamera() | Chooses a camera as the video source. |
| getSelectedCamera() | Returns information about the selected / current camera. |
| open() | Turn on the camera to start streaming live video. |
| close() | Stops video streaming and releases the camera. |
| isOpen() | Returns whether the selected camera is turned on / occupied. |
| pause() | Pauses video streaming without releasing the camera. |
| resume() | Resumes video streaming. |
| setResolution() | Sets the resolution of the current video input. |
| getResolution() | Returns the resolution of the current video input. |
Advanced Camera Control
| Name | Description |
|---|---|
| setFrameRate() | Adjusts the frame rate. |
| getFrameRate() | Returns the real-time frame rate. |
| turnOnTorch() | Turns on the torch/flashlight if the current camera supports it. |
| turnOffTorch() | Turns off the torch/flashlight. |
| setZoom() | Sets the zoom level of the video. |
| setFocus() | Sets the focus mode and focus distance of the camera. |
| getFocus() | Gets the focus mode and focus distance of the camera. |
| getCapabilities() | Inspects and returns the capabilities of the selected camera. |
| getCameraSettings() | Returns the current values for each constrainable property of the selected camera. |
| setColorTemperature() | Adjusts the color temperature of the selected camera. |
| setExposureCompensation() | Sets the exposure compensation index of the selected camera. |
Frame Acquisition
| Name | Description |
|---|---|
| setScanRegion() | Specifies which part of the original video is considered when processing frames. |
| getScanRegion() | Returns the scan region. |
| getFrame() | Returns a DCEFrame object which contains the image data of the latest frame from the video input. |
| getFrameFromBuffer() | Returns a DCEFrame object which contains the image data of the specified buffered frame. |
| startFetchingLoop() | Starts a fetching loop that continuously put frames in a buffer. |
| stopFetchingLoop() | Stops the fetching loop. |
| isFetchingLoopStarted() | Returns the state of the fetching loop. |
| maxNumberOfFramesInBuffer | Sets or returns how many frames can be buffered. |
| numberOfFramesInBuffer | Returns how many frames there are in the buffer. |
| loopInterval | Returns or sets the start time of the next fetch operation. |
| singleFrameMode | Returns or sets whether to enable the singe-frame mode. |
UI
| Name | Description |
|---|---|
| getVisibleRegion() | Returns a Region object which specifies which part of the original video is shown in the video element. |
| addScanRegionOverlayCanvas() | Add a canvas of the same size as the scan area directly above the scan area. |
| ifShowScanRegionMask | Returns or sets whether the scan region mask is shown. |
| ifShowScanRegionLaser | Returns or sets whether the laser indicator is shown in the scan region. |
| setScanRegionMaskStyle() | Sets the styles for the scan region mask. |
| setVideoFit() | Sets the object-fit CSS property of the video element. |
| getVideoFit() | Returns the value of the object-fit CSS property of the video element. |
| setViewDecorator() | Sets and shows the view decorator. |
| getViewDecorator() | Gets what view decorator is shown. |
| setViewDecoratorLineWidth() | Sets the line width for drawing the view decorator. |
| setViewDecoratorStrokeStyle() | Sets the stroke style for drawing the view decorator. |
| setViewDecoratorFillStyle() | Sets the fill style for drawing the view decorator. |
| setViewDecoratorMaskFillStyle() | Sets the fill style for drawing the ask for the view decorator. |
Auxiliary APIs
| Name | Description |
|---|---|
| on() | Attach an event handler function for a built-in event. |
| off() | Remove an event handler. |
| dispose() | Releases all resources used by the CameraEnhancer instance. |
| getVersion() | Returns the version of the library. |
| detectEnvironment() | Returns a report on the current running environments. |