Gathering detailed insights and metrics for @spoonconsulting/cordova-plugin-simple-camera-preview
Gathering detailed insights and metrics for @spoonconsulting/cordova-plugin-simple-camera-preview
Gathering detailed insights and metrics for @spoonconsulting/cordova-plugin-simple-camera-preview
Gathering detailed insights and metrics for @spoonconsulting/cordova-plugin-simple-camera-preview
cordova plugin for a showing simple camera preview
npm install @spoonconsulting/cordova-plugin-simple-camera-preview
Typescript
Module System
Node Version
NPM Version
2.0.41
Updated on May 28, 2025
Add aspect ratio support
Updated on May 23, 2025
Enhance torch error reporting
Updated on May 06, 2025
Android: Change flash state synchronously
Updated on Apr 21, 2025
Improve camera startup delay iOS
Updated on Apr 16, 2025
Add support for switching to the front camera
Updated on Feb 28, 2025
Objective-C (43.12%)
Java (40.1%)
TypeScript (9.33%)
JavaScript (3.41%)
SCSS (2.01%)
HTML (1.04%)
Metal (0.99%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
4 Stars
614 Commits
1 Forks
5 Watchers
113 Branches
12 Contributors
Updated on Jul 15, 2025
Latest Version
2.0.44
Package Id
@spoonconsulting/cordova-plugin-simple-camera-preview@2.0.44
Unpacked Size
127.95 kB
Size
25.75 kB
File Count
15
NPM Version
10.8.2
Node Version
20.19.3
Published on
Jul 15, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Cordova plugin that allows simple camera preview and taking pictures from Javascript and HTML
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.
1html, body, .ion-app, .ion-content { 2 background-color: transparent; 3}
for newer version ionic use the following:
1html, body, .ion-app, .ion-content { 2 --background: transparent; 3} 4
Make sure to set up the camera size as follows:
1const aspectRatio = 3/4; // or 9/16 2const cameraSize = this.getCameraSize(aspectRatio); 3 4getCameraSize(aspectRatio) { 5 let height; 6 let width; 7 const ratio = 4 / 3; 8 const min = Math.min(window.innerWidth, window.innerHeight); 9 10 [width, height] = [min, Math.round(min / aspectRatio)]; 11 if (this.isLandscape()) { 12 [width, height] = [height, width]; 13 } 14 15 return { 16 x: (window.innerWidth - width) / 2, 17 y: (window.innerHeight - height) / 2, 18 width, 19 height, 20 }; 21} 22 23isLandscape() { 24 return Math.abs(window.orientation % 180) === 90; 25} 26
Uses Google's CameraX API
Starts the camera preview instance.
1const params = { 2 targetSize: 1024, 3 lens: 'auto', // Camera lens (auto or wide). Default is auto. 4 direction: 'back', // Camera direction (front or back). Default is back. 5 aspectRatio: '3:4', // Camera aspect ratoio (3:4 or 9:16). Default is 3:4. 6 ...cameraSize, 7} 8 9SimpleCameraPreview.enable(params, () => { 10 console.log("Camera enabled"); 11});
1SimpleCameraPreview.disable(params, () => { 2 console.log("Camera disabled"); 3});
1let options = { 2 flash: true, 3}; 4 5SimpleCameraPreview.capture(options, (imagaeNativePath) => { 6 console.log(imagaeNativePath); 7});
Set the camera frame size
1let size = { 2 x: 0, 3 y: 0, 4 width: 1080, 5 height: 1920, 6}; 7 8SimpleCameraPreview.setSize(size, () => { 9 console.log("Camera frame size set"); 10});
Check if device has ultra-wide camera
1 2SimpleCameraPreview.deviceHasUltraWideCamera(size, (value: boolean) => { 3 console.log("Device has ultra-wide camera?: ", value); 4});
Switch camera between wide or auto and set the camera direction (front or back) dynamically. Change camera aspect ratio.
The options variable can take the following keys:
lens:
"wide"
– Use a wide-angle lens."auto"
– Automatically select the best available lens.direction:
"front"
– Use the front-facing camera."back"
– Use the rear-facing camera.aspectRatio:
"3:4"
– Display 3/4 preview."9:16"
– Display 9/16 preview.Currently, the wide-angle lens functionality is not supported for the front-facing camera. If the lens
is set to "wide"
and the direction
is set to "front"
, the camera will default to the "auto"
lens instead of switching to the wide lens.
1const params = { 2 lens: "wide", 3 direction: "back", // Specify camera direction 4 aspectRatio: "9:16", 5 ...cameraSize, 6}; 7 8SimpleCameraPreview.switchCameraTo( 9 params, 10 (value: unknown) => { 11 return (typeof value === "boolean" ? value : false); 12 }, 13 (e: unknown) => { 14 console.log("cannot switch camera: ", e); 15 } 16);
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no binaries found in the repo
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More