1.0.0 • Published 5 years ago

cordova-plugin-simple-camera-preview v1.0.0

Weekly downloads
-
License
Apache 2.0
Repository
github
Last release
5 years ago

Cordova Plugin Simple Camera Preview

Cordova plugin that allows simple camera preview and taking pictures from Javascript and HTML

Installation

cordova plugin add https://github.com/spoonconsulting/cordova-plugin-simple-camera-preview.git

ionic cordova plugin add https://github.com/spoonconsulting/cordova-plugin-simple-camera-preview.git

Make the webview html background color transparent

html, body, .ion-app, .ion-content {
  background-color: transparent;
}

Android

Uses camera2 api

Methods

enable()

Starts the camera preview instance.

CameraPreview.enable(()=>console.log('camera enabled'));

disable()

Stops the camera preview instance.

SimpleCameraPreview.disable(()=>console.log('camera disabled'));

capture(options, successCallback, errorCallback)

Take the picture

let options  = {
  flash: true
}
SimpleCameraPreview.capture(options, (imageName)=>{
  //image will be in cordova data directory
});