nativescript-dynamsoft-camera-enhancer
by xulihang | v1.1.2
Nativescript plugin for Dynamsoft Camera Enhancer
npm i --save nativescript-dynamsoft-camera-enhancer

nativescript-dynamsoft-camera-enhancer

Nativescript plugin for Dynamsoft Camera Enhancer.

We can use it for camera preview, which is the base of building a barcode scanner, a text scanner, a document scanner, etc.

Installation

npm install nativescript-dynamsoft-camera-enhancer

Usage

Add the camera view in the layout:

<Page xmlns="http://schemas.nativescript.org/tns.xsd" 
xmlns:dce="nativescript-dynamsoft-camera-enhancer"
navigatingTo="navigatingTo" class="page">

<GridLayout rows="*, auto, auto">
<dce:CameraEnhancer
loaded="{{ dceLoaded }}"
rowSpan="3"
active="{{ isActive }}"
cameraID="{{ desiredCamera }}"
torch="{{ desiredTorchStatus }}">
</dce:CameraEnhancer>
</GridLayout>
</Page>

Get the camera enhancer intanse in the code behind:

dce:CameraEnhancer;
dceLoaded(args: EventData) {
this.dce = <CameraEnhancer>args.object;
}

Methods:

captureFrame(): any;
captureFrameAsBase64(): string;
getAllCameras(): string[];
getSelectedCamera(): string;
getCameraEnhancer(): any;
getResolution(): Resolution;
setResolution(resolution:Resolution): void;
setZoom(factor:number);
getMaxZoomFactor(): number;
open(): void;
close(): void;

Properties:

active:boolean //whether the camera is open
torch:boolean //whether the torch is on
cameraID:string //the selected camera ID

Interfaces:

export interface Resolution {
width: number;
height: number;
}

License

Apache License Version 2.0