dynamsoft-camera-enhancer
Advanced tools
Comparing version 3.0.1 to 3.1.0-beta10191915
@@ -10,2 +10,3 @@ import { PlayCallbackInfo } from '../interface/playcallbackinfo'; | ||
import { Warning } from '../interface/warning'; | ||
declare type PixelFormat = "grey" | "grey32" | "rgba" | "rbga" | "grba" | "gbra" | "brga" | "bgra"; | ||
export default class CameraEnhancer implements ImageSource { | ||
@@ -19,3 +20,2 @@ private static _jsVersion; | ||
/** | ||
* modify from https://gist.github.com/2107/5529665 | ||
* @ignore | ||
@@ -25,3 +25,3 @@ */ | ||
browser: string; | ||
version: string | number; | ||
version: number; | ||
OS: string; | ||
@@ -42,3 +42,3 @@ }; | ||
* ```js | ||
* Dynamsoft.DCE.CameraEnhancer.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-camera-enhancer@3.0.1/dist/"; | ||
* Dynamsoft.DCE.CameraEnhancer.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-camera-enhancer@3.1.0/dist/"; | ||
* ``` | ||
@@ -49,3 +49,3 @@ */ | ||
/** | ||
* Check if storage is available | ||
* Check if storage is available. | ||
* @ignore | ||
@@ -67,5 +67,4 @@ */ | ||
* The url of the default UI. | ||
* Can only be changed before `createInstance`. | ||
* ```js | ||
* Dynamsoft.DCE.CameraEnhancer.defaultUIElementURL = "https://cdn.jsdelivr.net/npm/dynamsoft-camera-enhancer@3.0.1/dist/dce.ui.html"; | ||
* Dynamsoft.DCE.CameraEnhancer.defaultUIElementURL = "https://cdn.jsdelivr.net/npm/dynamsoft-camera-enhancer@3.1.0/dist/dce.ui.html"; | ||
* let pEnhancer = null; | ||
@@ -93,3 +92,3 @@ * (async()=>{ | ||
* ```html | ||
* <div class="dce-video-container" style="postion:relative;width:100%;height:500px;"></div> | ||
* <div class="dce-video-container" style="position:relative;width:100%;height:500px;"></div> | ||
* <script> | ||
@@ -109,3 +108,9 @@ * let pEnhancer = null; | ||
setUIElement(elementOrUrl: HTMLElement | string): Promise<void>; | ||
/** | ||
* @ignore | ||
*/ | ||
appendAndShowUI(): void; | ||
/** | ||
* @ignore | ||
*/ | ||
hideUI(): void; | ||
@@ -148,21 +153,31 @@ private _singleFrameMode; | ||
private styleEls; | ||
private _frameColorMode; | ||
private _defaultFrameColorMode; | ||
/** | ||
* Set 'getFrame()' target color mode. | ||
* Supported vaule: 'rgba', 'rbga', 'grba', 'gbra', 'brga', 'bgra', 'grey'. | ||
* @deprecated | ||
*/ | ||
set frameColorMode(value: string); | ||
get frameColorMode(): string; | ||
private currentFSColorMode; | ||
ifReuseArrayBufferView: boolean; | ||
set frameColorMode(value: PixelFormat); | ||
get frameColorMode(): PixelFormat; | ||
private _framePixelFormat; | ||
private _defaultFramePixelFormat; | ||
/** | ||
* Set 'getFrame()' target color mode. | ||
* Supported vaule: 'rgba', 'rbga', 'grba', 'gbra', 'brga', 'bgra', 'grey'. | ||
*/ | ||
set framePixelFormat(value: PixelFormat); | ||
get framePixelFormat(): PixelFormat; | ||
private mapPixelFormatString_Enum; | ||
private shaderPixelFormat; | ||
maxVideoCvsLength: number; | ||
private _reusedCvs; | ||
private _reusedWebGLCvs?; | ||
private _reusedWebGLCtx?; | ||
private _reusedDataContainer?; | ||
private _tempDataContainer?; | ||
private _webGLTexture; | ||
private _webGLProgramInfo; | ||
private _webGLBuffers; | ||
private _softwareScale; | ||
private _recordedStates; | ||
/** | ||
* @deprecated | ||
*/ | ||
playCallbackInfo: PlayCallbackInfo; | ||
@@ -179,3 +194,7 @@ private _toCanvas; | ||
readonly isCameraEnhancer: boolean; | ||
/** | ||
* @deprecated | ||
*/ | ||
readonly isDisposed: boolean; | ||
readonly disposed: boolean; | ||
/** | ||
@@ -210,3 +229,5 @@ * Set src to video element to play static video. | ||
private _ev_documentHideEvent; | ||
private _divVideoContainer; | ||
containerClassName: string; | ||
private _elContainer; | ||
private _videoContainer; | ||
private _video; | ||
@@ -229,2 +250,12 @@ /** | ||
getVideoFit(): string; | ||
/** | ||
* For debug. | ||
* @ignore | ||
*/ | ||
_showElClassName(): void; | ||
/** | ||
* For debug. | ||
* @ignore | ||
*/ | ||
_hideElClassName(): void; | ||
/** @ignore */ | ||
@@ -311,10 +342,10 @@ _cvsScanRegion: HTMLCanvasElement; | ||
* adjust overlay to match'_scanRegion' | ||
* might be called when: | ||
* Might be called when: | ||
* 1. 'addScanRegionOverlayCanvas' is called; | ||
* 2. 'scanRegion' is set; | ||
* 3. camera resolution changes in 'play()'; | ||
* 4. video container resizes; | ||
* 4. container resizes; | ||
* 5. 'setVideoFit' is called; | ||
* 6. 'bOpen' is set to true; | ||
* 7. select a new image in singleFrameMode | ||
* 7. '_clickIptSingleFrameMode' is triggered; | ||
* @param overlay | ||
@@ -366,8 +397,9 @@ * @private | ||
/** | ||
* might be called when: | ||
* Might be called when: | ||
* 1. 'setViewDecoratorLineWidth', 'setViewDecoratorStrokeStyle', 'setViewDecoratorFillStyle' or 'setViewDecoratorMaskFillStyle' is called; | ||
* 2. camera resolution changes in 'play()'; | ||
* 3. video container resizes; | ||
* 3. container resizes; | ||
* 4. 'setVideoFit' is called; | ||
* 5. 'bOpen' is set to true; | ||
* 6. '_clickIptSingleFrameMode' is triggered; | ||
* @ignore | ||
@@ -404,3 +436,3 @@ */ | ||
/** | ||
* might be called when: | ||
* Might be called when: | ||
* 1. 'bOpen' is set to true; | ||
@@ -411,3 +443,4 @@ * 2. 'scanRegion' is set; | ||
* 5. 'setVideoFit' is called; | ||
* 6. select a new image in singleFrameMode | ||
* 6. select a new image in singleFrameMode; | ||
* 7. container resizes; | ||
* @ignore | ||
@@ -417,8 +450,9 @@ */ | ||
/** | ||
* might be called when: | ||
* Might be called when: | ||
* 1. 'bOpen' is set to true; | ||
* 2. 'scanRegion' is set; | ||
* 3. camera resolution changes in 'play()'; | ||
* 4. video container resizes; | ||
* 4. container resizes; | ||
* 5. 'setVideoFit' is called; | ||
* 6. '_clickIptSingleFrameMode' is triggered; | ||
* @ignore | ||
@@ -499,2 +533,4 @@ */ | ||
static createInstance(config?: any): Promise<CameraEnhancer>; | ||
private static playVideo; | ||
private static findBestRearCamera; | ||
/** | ||
@@ -569,3 +605,3 @@ * | ||
*/ | ||
getAllCameras(notForceGet?: boolean): Promise<VideoDeviceInfo[]>; | ||
getAllCameras(force?: boolean): Promise<VideoDeviceInfo[]>; | ||
private _renderSelCameraInfo; | ||
@@ -621,3 +657,3 @@ /** | ||
*/ | ||
getResolutions(forceGet?: boolean): Promise<Array<Array<number>>>; | ||
getResolutions(force?: boolean): Promise<Array<Array<number>>>; | ||
private readonly mapCameraEvents; | ||
@@ -689,2 +725,4 @@ /** | ||
* Only available when the camera is open. | ||
* More information: | ||
* https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities | ||
* ``` | ||
@@ -714,5 +752,13 @@ * > enhancer.getCapabilities() | ||
getCapabilities(): MediaTrackCapabilities; | ||
/** @ignore */ | ||
/** | ||
* See: | ||
* https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/getSettings | ||
* @ignore | ||
* */ | ||
getCameraSettings(): MediaTrackSettings; | ||
/** @ignore */ | ||
/** | ||
* See: | ||
* https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/getConstraints | ||
* @ignore | ||
* */ | ||
getConstraints(): MediaTrackConstraints; | ||
@@ -723,2 +769,4 @@ /** | ||
* It's a low-level API, usually you can use the wrapped APIs instead. | ||
* More information: | ||
* https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/applyConstraints | ||
* ```js | ||
@@ -763,2 +811,3 @@ * await enhancer.applyConstraints({ frameRate: { ideal:5 } }); | ||
setColorTemperature(value: number): Promise<void>; | ||
getColorTemperature(): number; | ||
/** | ||
@@ -775,6 +824,6 @@ * Adjusts the exposure level. Only available in Chrome and Edge. | ||
setExposureCompensation(value: number): Promise<void>; | ||
getExposureCompensation(): number; | ||
/** | ||
* Adjusts the zoom ratio. Only available in Chrome and Edge. | ||
* Adjusts the zoom ratio. | ||
* Only available when the camera is open. | ||
* Will reject if not support. | ||
* ```js | ||
@@ -787,2 +836,3 @@ * await enhancer.setZoom(400); | ||
setZoom(value: number): Promise<void>; | ||
getZoom(): number; | ||
/** | ||
@@ -830,3 +880,17 @@ * Adjusts the frame rate. Only available in Chrome, Edge and Safari. | ||
getFocus(): Object; | ||
private _setHardwareScale; | ||
private _getHardwareScale; | ||
private _setSoftwareScale; | ||
private _getSoftwareScale; | ||
/** | ||
* Might be called when: | ||
* 1. container resizes; | ||
* 2. 'setVideoFit()' is called; | ||
* 3. '_scaleVideo()' is called; | ||
* 4. resolution changed; | ||
* @ignore | ||
*/ | ||
private _updateVideoContainerStyle; | ||
private _scaleVideo; | ||
/** | ||
* | ||
@@ -859,37 +923,12 @@ * @param width width of the canvas | ||
getImage(): DSImage; | ||
private _drawImage; | ||
private _readCvsData; | ||
private _transformPixelFormat; | ||
private _getImageData; | ||
_getVideoData(bufferContainer?: Uint8Array, options?: { | ||
region?: Region; | ||
pixelFormat?: PixelFormat; | ||
scale?: number; | ||
}): DCEFrame; | ||
/** | ||
* | ||
* @param region | ||
* @param bufferContainer | ||
* @returns | ||
* @ignore | ||
*/ | ||
_getVideoFrame(region?: Region, bufferContainer?: Uint8Array): DCEFrame; | ||
/** | ||
* | ||
* @param source | ||
* @param sourceWidth | ||
* @param sourceHeight | ||
* @param postion | ||
* @param bufferContainer | ||
* @param options | ||
* @returns | ||
* @ignore | ||
*/ | ||
_getImageData(source: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, sourceWidth: number, sourceHeight: number, postion: { | ||
sx: number; | ||
sy: number; | ||
sWidth: number; | ||
sHeight: number; | ||
dWidth: number; | ||
dHeight: number; | ||
}, bufferContainer?: Uint8Array, options?: { | ||
targetColorMode?: string; | ||
bUseWebGL?: boolean; | ||
}): { | ||
data: Uint8Array; | ||
colorMode: string; | ||
_bUseWebGL: boolean; | ||
}; | ||
/** | ||
* @private | ||
@@ -925,2 +964,11 @@ */ | ||
private _createDrawingLayerBaseCvs; | ||
/** | ||
* Might be called when: | ||
* 1. '_clickIptSingleFrameMode' is triggered; | ||
* 2. 'bOpen' is set to 'true'; | ||
* 3. container resizes; | ||
* 4. resolution is changed; | ||
* 5. 'setOriginalImage()', 'showOriginalImage()' or '_hideOriginalImage()' is called; | ||
* @ignore | ||
*/ | ||
private _updateDrawingLayersSize; | ||
@@ -954,2 +1002,3 @@ _createDrawingLayer(drawingLayerId?: number): import("./drawinglayer").default; | ||
} | ||
export {}; | ||
//# sourceMappingURL=cameraenhancer.d.ts.map |
@@ -0,1 +1,3 @@ | ||
import { Note } from '../../interface/Note'; | ||
import { DrawingItemEvent } from '../../interface/DrawingItemEvent'; | ||
export declare class DrawingItem { | ||
@@ -14,3 +16,4 @@ static arrMediaTypes: string[]; | ||
_mapStyle: Map<string, any>; | ||
protected mapEvents: Map<string, Function[]>; | ||
protected mapEvent_Callbacks: Map<string, Map<Function, Function>>; | ||
protected mapNoteName_Content: Map<string, Array<any>>; | ||
readonly isDrawingItem: boolean; | ||
@@ -20,10 +23,25 @@ constructor(fabricObject: fabric.Object, styleId?: number); | ||
_getFabricObject(): fabric.Object; | ||
on(event: string, callback: () => void, _innerUse?: boolean): void; | ||
off(event: string, callback: () => void): void; | ||
on(eventName: string, listener: (event: DrawingItemEvent) => void): void; | ||
off(eventName: string, listener: (event: DrawingItemEvent) => void): void; | ||
_setEditable(editable: boolean): void; | ||
hasNote(name: string): boolean; | ||
addNote(note: Note, replace?: boolean): void; | ||
getNote(name: string): Note; | ||
getNotes(): Array<Note>; | ||
updateNote(name: string, content: any, mergeContent?: boolean): void; | ||
deleteNote(name: string): void; | ||
clearNotes(): void; | ||
protected _extendSet(property: string, value: any): boolean; | ||
protected _extendGet(property: string): any; | ||
/** | ||
* @deprecated | ||
*/ | ||
set(property: string, value: any): void; | ||
get(property: any): any; | ||
/** | ||
* @deprecated | ||
*/ | ||
get(property: string): any; | ||
setAttribute(attribute: string, value: any): void; | ||
getAttribute(attribute: string): void; | ||
} | ||
//# sourceMappingURL=drawingitem.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { DrawingItem } from "./drawingitem"; | ||
import { DT_Polygon } from "./dt_polygon"; | ||
import { Point } from "../../interface/point"; | ||
export declare class DT_Line extends DrawingItem { | ||
export declare class DT_Line extends DT_Polygon { | ||
constructor(startPoint: Point, endPoint: Point, styleId?: number); | ||
@@ -5,0 +5,0 @@ protected _extendSet(property: string, value: any): boolean; |
@@ -0,3 +1,7 @@ | ||
import { fabric } from "dm-fabric"; | ||
import { DrawingItem } from "./drawingitem"; | ||
import { Point } from "../../interface/point"; | ||
export declare function polygonPositionHandler(dim: any, finalMatrix: any, fabricObject: any): fabric.Point; | ||
export declare function actionHandler(eventData: any, transform: any, x: any, y: any): boolean; | ||
export declare function anchorWrapper(anchorIndex: any, fn: any): (eventData: any, transform: any, x: any, y: any) => any; | ||
export declare class DT_Polygon extends DrawingItem { | ||
@@ -4,0 +8,0 @@ constructor(vertices: Array<Point>, styleId?: number); |
import { DrawingItem } from "./drawingitem"; | ||
export declare class DT_Text extends DrawingItem { | ||
constructor(text: string, x: number, y: number, styleId?: number); | ||
private _text; | ||
constructor(text: string, x: number, y: number, width: number, styleId?: number); | ||
protected _extendSet(property: string, value: any): boolean; | ||
protected _extendGet(property: string): any; | ||
} | ||
//# sourceMappingURL=dt_text.d.ts.map |
@@ -52,7 +52,7 @@ import { fabric } from "dm-fabric"; | ||
setDrawingItems(drawingItems: Array<DrawingItem>): void; | ||
getDrawingItems(): Array<DrawingItem>; | ||
getDrawingItems(filter?: ((item: DrawingItem) => boolean)): Array<DrawingItem>; | ||
getSelectedDrawingItems(): Array<DrawingItem>; | ||
hasDrawingItem(drawingItem: DrawingItem): boolean; | ||
clearDrawingItems(): void; | ||
setDrawingStyle(drawingStyleOrId: DrawingStyle | number, mediaType?: string, styleSelector?: string): void; | ||
setDrawingStyle(drawingStyleId: number, mediaType?: string, styleSelector?: string): void; | ||
setMode(newMode: string): void; | ||
@@ -59,0 +59,0 @@ getMode(): string; |
@@ -10,2 +10,3 @@ import CameraEnhancer from "./class/cameraenhancer"; | ||
import { Warning } from "./interface/warning"; | ||
import { DrawingItemEvent } from "./interface/DrawingItemEvent"; | ||
declare const DrawingItem: { | ||
@@ -20,3 +21,3 @@ DT_Arc: typeof DT_Arc; | ||
}; | ||
export { CameraEnhancer, DrawingItem, PlayCallbackInfo, Region, DCEFrame, Area, Point, DrawingStyle, Warning }; | ||
export { CameraEnhancer, DrawingItem, PlayCallbackInfo, Region, DCEFrame, Area, Point, DrawingStyle, Warning, DrawingItemEvent }; | ||
//# sourceMappingURL=index.d.ts.map |
import { Region } from './region'; | ||
export interface DCEFrame { | ||
import { DSImage } from './dsimage'; | ||
export interface DCEFrame extends DSImage { | ||
data: Uint8Array; | ||
@@ -9,3 +10,8 @@ region: Region; | ||
height: number; | ||
stride?: number; | ||
/** | ||
* @deprecated | ||
*/ | ||
colorMode: string; | ||
pixelFormat: string; | ||
timeSpent: number; | ||
@@ -12,0 +18,0 @@ timeStamp: number; |
@@ -5,4 +5,5 @@ export interface DSImage { | ||
height: number; | ||
stride?: number; | ||
pixelFormat: string; | ||
} | ||
//# sourceMappingURL=dsimage.d.ts.map |
{ | ||
"name": "dynamsoft-camera-enhancer", | ||
"version": "3.0.1", | ||
"version": "3.1.0-beta10191915", | ||
"description": "Allow your website to easily control cameras on desktop and mobile devices.", | ||
@@ -36,5 +36,8 @@ "private": false, | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build-dev": "rollup -c --environment BUILD:development", | ||
"build": "rollup -c --environment BUILD:production", | ||
"build:doc": "typedoc" | ||
"rollup-dev": "rollup -c --environment BUILD:development", | ||
"rollup": "rollup -c --environment BUILD:production", | ||
"build-dev": "python ./build-dev.py", | ||
"build": "python ./build.py", | ||
"build:doc": "typedoc", | ||
"update:readme": "node ./updateReadme.js" | ||
}, | ||
@@ -47,3 +50,7 @@ "license": "", | ||
"files": [ | ||
"/dist", | ||
"/dist/*.js", | ||
"/dist/*.mjs", | ||
"/dist/*.html", | ||
"/dist/*.wasm", | ||
"/dist/**/*.d.ts", | ||
"/Api Reference.url", | ||
@@ -62,4 +69,6 @@ "/legal.txt", | ||
"detect-browser-node-ssr": "^2.0.0", | ||
"dm-browser-info": "http://npm.dynamsoftwebtwain.com/dm-browser-info/-/dm-browser-info-1.0.5.tgz", | ||
"dm-browser-info": "http://npm.dynamsoftwebtwain.com/dm-browser-info/-/dm-browser-info-1.0.7.tgz", | ||
"dm-curscript-path": "http://npm.dynamsoftwebtwain.com/dm-curscript-path/-/dm-curscript-path-1.0.3.tgz", | ||
"inline-css": "^4.0.1", | ||
"markdown-styles": "^3.2.0", | ||
"rollup": "^2.58.0", | ||
@@ -66,0 +75,0 @@ "rollup-plugin-terser": "7.0.2", |
@@ -7,4 +7,10 @@ # Dynamsoft Camera Enhancer for Your Website | ||
In this guide, you will learn step by step on how to integrate this SDK into your website. | ||
> **Example Usage** | ||
> | ||
> See how Dynamsoft Camera Enhancer helps in camera control and video recognition: | ||
> - **Barcode scanning from video stream**: check [Dynamsoft Barcode Reader JS User Guide](https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/user-guide/?ver=latest) | ||
> - **MRZ scanning and OCR from video stream**: check [Dynamsoft Label Recognizer JS User Guide](https://www.dynamsoft.com/label-recognition/programming/javascript/user-guide.html?ver=latest&utm_source=dceguide) | ||
In this guide, you will learn step by step on how to integrate the Dynamsoft Camera Enhancer SDK into your website. | ||
**Table of Contents** | ||
@@ -21,8 +27,2 @@ | ||
> **Example Usage** | ||
> | ||
> Read the user guide of Dynamsoft Label Recognizer on how DCE helps the SDK achieve video recognition: | ||
> | ||
> * [Dynamsoft Label Recognizer User Guide](https://www.dynamsoft.com/label-recognition/programming/javascript/user-guide.html?ver=latest&utm_source=dceguide) | ||
## Getting Started | ||
@@ -39,3 +39,3 @@ | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-camera-enhancer@3.0.1/dist/dce.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-camera-enhancer@3.1.0/dist/dce.js"></script> | ||
``` | ||
@@ -46,3 +46,3 @@ | ||
```html | ||
<script src="https://unpkg.com/dynamsoft-camera-enhancer@3.0.1/dist/dce.js"></script> | ||
<script src="https://unpkg.com/dynamsoft-camera-enhancer@3.1.0/dist/dce.js"></script> | ||
``` | ||
@@ -75,3 +75,3 @@ | ||
```html | ||
<script src="/dce-js-3.0.1/dist/dce.js"></script> | ||
<script src="/dce-js-3.1.0/dist/dce.js"></script> | ||
``` | ||
@@ -130,7 +130,6 @@ | ||
```javascript | ||
// To make sure the following line takes effect, put it before the API `open()` is called. | ||
Dynamsoft.DCE.CameraEnhancer.defaultUIElementURL = "THE-URL-TO-THE-FILE"; | ||
``` | ||
> You must set `defaultUIElementURL` before you call `createInstance()` . | ||
* Append the default UI element to your page as shown in [Configure the CameraEnhancer object](#configure-the-cameraenhancer-object), customize it if necessary. | ||
@@ -137,0 +136,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1117579
40
5138
18
3
255