Code Monkey home page Code Monkey logo

cordova-cameraplus's Introduction

CameraPlus Plugin For Cordova

Supported platform:

  • iOS
  • Android

CameraPlus has the following features

  • Retrieve live images from Camera in the background
  • Retrieve the images in HTML/JS in Base64 so that they can be displayed, saved in localstorage and sent using HTTP POST
  • Set the target format (iOS only)
  • Automatically stops capturing if no request made for 5 seconds, wake up camera when image requested

How to use CameraPlus?

Add the plugin to your cordova project:

cordova plugin add https://github.com/moonware/cordova-cameraplus.git

Javascript APIs

startCamera( options, success_callback, error_callback );

stopCamera( success_callback, error_callback );

getVideoFormats( success_callback, error_callback );

setVideoFormat( success_callback, error_callback );

getJpegImage( success_callback, error_callback );

getJpegImage will return a JPEG image encoded in base 64.

You can then set it to an image from HTML/JS part of the application:

Standard JS:

camImage.src = "data:image/jpeg;base64," + data;

or

AngularJS/Ionic:

<img src="data:image/jpeg;base64, {{data}}">

Test Application

A ready to try Ionic application is available here: https://github.com/Moonware/cordova-cameraplus-testapp

Known Issues

On iOS there are known memory leaks issues related to UIWebView, the application will most likely crash after a few minutes of intensive usage (pulling images at 15-20fps). The Android version doesn't seem to suffer from similar problems.

If you think that you can help on resolving this problem, feel free to participate in one of these topic:

http://forum.ionicframework.com/t/camera-plus-cordova-plugin-ios-help-needed/18375

http://stackoverflow.com/questions/28771897/cordova-custom-camera-plugin-ios-memory-leak

Known Solution

In order to solve the above problem, we have decided to change the approach and to use HTTP for transferring the images between the native code back to Cordova rather than using the "standard" plugin approach.

Therefore we have created the CameraServer Plugin which is a fusion between CameraPlus and CorHttpd:

CameraServer Plugin

cordova-cameraplus's People

Contributors

w3t avatar eard7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.