@spoonconsulting/cordova-plugin-simple-camera-preview

    2.0.3 • Public • Published

    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 Google's CameraX API

    Methods

    enable(options, successCallback, errorCallback)

    Starts the camera preview instance.

    const params = {
      direction: 'back' // Camera direction (front or back). Default is back.
    }
    
    SimpleCameraPreview.enable(params, () => {
      console.log("Camera enabled");
    });

    disable(successCallback, errorCallback)

    Stops the camera preview instance.

    SimpleCameraPreview.disable(params, () => {
      console.log("Camera disabled");
    });

    capture(options, successCallback, errorCallback)

    Take the picture

    let options = {
      flash: true
    };
    
    SimpleCameraPreview.capture(options, (imagaeNativePath) => {
      console.log(imagaeNativePath);
    });

    Install

    npm i @spoonconsulting/cordova-plugin-simple-camera-preview

    DownloadsWeekly Downloads

    68

    Version

    2.0.3

    License

    Apache 2.0

    Unpacked Size

    55.4 kB

    Total Files

    13

    Last publish

    Collaborators

    • zafirskthelifehacker
    • ombr
    • dinitri-ragoo-spoon
    • azharbeebeejaun