nativescript-dynamsoft-camera-enhancer
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

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

Package Sidebar

Install

npm i nativescript-dynamsoft-camera-enhancer

Weekly Downloads

2

Version

1.1.2

License

Apache-2.0

Unpacked Size

33.8 kB

Total Files

16

Last publish

Collaborators

  • xulihang