2.0.17 • Published 10 months ago
@spoonconsulting/cordova-plugin-simple-camera-preview v2.0.17
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
setOptions(options, successCallback, errorCallback)
Get the ratio for the camera preview instance (4:3, 16:9, ....).
const params = {
targetSize: 1024,
}
SimpleCameraPreview.setOptions(params, (ratio) => {
console.log(ratio);
});
enable(options, successCallback, errorCallback)
Starts the camera preview instance.
const params = {
targetSize: 1024,
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);
});
setSize(options, successCallback, errorCallback)
Set the camera frame size
let size = {
x: 0,
y: 0,
width: 1080,
height: 1920,
};
SimpleCameraPreview.setSize(size, () => {
console.log("Camera frame size set");
});
2.0.17
10 months ago
2.0.16
12 months ago
2.0.15
1 year ago
2.0.14
1 year ago
2.0.13
1 year ago
2.0.11
2 years ago
2.0.12
1 year ago
2.0.7
2 years ago
2.0.6
2 years ago
2.0.9
2 years ago
2.0.10
2 years ago
2.0.8
2 years ago
2.0.5
2 years ago
2.0.4
2 years ago
2.0.3
2 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
4 years ago
1.0.0
4 years ago