Cordova plugin that allows camera interaction from HTML code for showing camera preview below or above the HTML.
March 4, 2017 - We are currently drastically improving the plugin for a v1.0.0 release, in the meantime the API may change slightly. Please use master until a new version is released.
PR's are greatly appreciated. If your interested in maintainer status please create a couple PR's and then contact email@example.com
These are some features that are currently Android only, however we would love to see PR's for this functionality in iOS.
Use any one of the installation methods listed below depending on which framework you use.
cordova plugin addionic plugin addmeteor add cordova:cordova-plugin-camera-preview@#[latest_commit_id]<plugin spec="" source="git" />
x- Defaults to 0
y- Defaults to 0
width- Defaults to window.screen.width
height- Defaults to window.screen.height
camera- Options are 'front' and 'rear' - Defaults to 'rear'
toBack- Defaults to false - Set to true if you want your html in front of your preview
tapPhoto- Defaults to true - Does not work if toBack is set to false in which case you use the takePicture method
previewDrag- Defaults to true - Does not work if toBack is set to false
When setting the toBack to true, remember to add the style below on your app's HTML or body element:
Stops the camera preview instance.
Switch between the rear camera and front camera, if available.
Show the camera preview box.
Hide the camera preview box.
Take the picture. It defaults to max supported picture resolution if no width or height specified. If width and height are specified, it will choose a supported photo size that is closest to width and height specified and has closest aspect ratio to the preview. The argument
quality defaults to
85 and specifies the quality/compression value:
CameraPreview;// OR if you want to use the default options.CameraPreview;
Set the flash mode. Available flash modes are
torch. Torch mode is currently Android only
Set the color effect.
Set the zoom level. zoomMultipler option accepts an integer. Zoom level is initially at 1
Change the size of the preview window.
It is not possible to use your computers webcam during testing in the simulator, you must device test.
cordova-plugin-camera-preview-sample-app for a complete working Cordova example for Android and iOS platforms.
Maintained by Weston Ganger - @westonganger
Created by Marcel Barbosa Pinto @mbppower