Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capacitor-community/camera-preview

Package Overview
Dependencies
Maintainers
38
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor-community/camera-preview - npm Package Compare versions

Comparing version 3.1.0 to 4.0.0-0

18

dist/esm/definitions.d.ts

@@ -7,5 +7,5 @@ export declare type CameraPosition = 'rear' | 'front';

className?: string;
/** The preview width in pixels, default window.screen.width (applicable to the android and ios platforms only) */
/** The preview width in pixels, default window.screen.width */
width?: number;
/** The preview height in pixels, default window.screen.height (applicable to the android and ios platforms only) */
/** The preview height in pixels, default window.screen.height */
height?: number;

@@ -24,3 +24,3 @@ /** The x origin, default 0 (applicable to the android and ios platforms only) */

position?: CameraPosition | string;
/** Defaults to false - Capture images to a file and return back the file path instead of returning base64 encoded data */
/** Defaults to false - Capture images to a file and return the file path instead of returning base64 encoded data */
storeToFile?: boolean;

@@ -35,5 +35,5 @@ /** Defaults to false - Android Only - Disable automatic rotation of the image, and let the browser deal with it (keep reading on how to achieve it) */

lockAndroidOrientation?: boolean;
/** Defaults to false - Android and Web only. Set if camea preview can change opacity. */
/** Defaults to false - Android and Web only. Set if camera preview can change opacity. */
enableOpacity?: boolean;
/** Defaults to false - Android only. Set if camea preview will support pinch to zoom. */
/** Defaults to false - Android only. Set if camera preview will support pinch to zoom. */
enableZoom?: boolean;

@@ -46,3 +46,5 @@ }

width?: number;
/** The picture quality, 0 - 100, default 85 */
/** The picture quality, 0 - 100, default 85 on `iOS/Android`.
*
* If left undefined, the `web` implementation will export a PNG, otherwise a JPEG will be generated */
quality?: number;

@@ -73,5 +75,5 @@ }

flashMode: CameraPreviewFlashMode | string;
}): void;
flip(): void;
}): Promise<void>;
flip(): Promise<void>;
setOpacity(options: CameraOpacityOptions): Promise<{}>;
}

@@ -12,3 +12,3 @@ import { WebPlugin } from '@capacitor/core';

stop(): Promise<any>;
capture(_options: CameraPreviewPictureOptions): Promise<any>;
capture(options: CameraPreviewPictureOptions): Promise<any>;
captureSample(_options: CameraSampleOptions): Promise<any>;

@@ -15,0 +15,0 @@ getSupportedFlashModes(): Promise<{

@@ -14,3 +14,3 @@ import { WebPlugin } from '@capacitor/core';

audio: !options.disableAudio,
video: true,
video: true
})

@@ -47,6 +47,9 @@ .then((stream) => {

const constraints = {
video: true,
video: {
width: { ideal: options.width },
height: { ideal: options.height }
}
};
if (options.position === 'rear') {
constraints.video = { facingMode: 'environment' };
constraints.video.facingMode = 'environment';
this.isBackCamera = true;

@@ -85,3 +88,3 @@ }

}
async capture(_options) {
async capture(options) {
return new Promise((resolve, _) => {

@@ -100,4 +103,11 @@ const video = document.getElementById('video');

context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
let base64EncodedImage;
if (options.quality != undefined) {
base64EncodedImage = canvas.toDataURL('image/jpeg', options.quality / 100.0).replace('data:image/jpeg;base64,', '');
}
else {
base64EncodedImage = canvas.toDataURL('image/png').replace('data:image/png;base64,', '');
}
resolve({
value: canvas.toDataURL('image/png').replace('data:image/png;base64,', ''),
value: base64EncodedImage,
});

@@ -104,0 +114,0 @@ });

{
"name": "@capacitor-community/camera-preview",
"version": "3.1.0",
"version": "4.0.0-0",
"description": "Camera preview",

@@ -22,7 +22,7 @@ "main": "dist/esm/index.js",

"dependencies": {
"@capacitor/core": "latest"
"@capacitor/core": "^4.0.0"
},
"devDependencies": {
"@capacitor/android": "latest",
"@capacitor/ios": "latest",
"@capacitor/android": "^4.0.0",
"@capacitor/ios": "^4.0.0",
"@ionic/eslint-config": "^0.3.0",

@@ -34,8 +34,8 @@ "@ionic/prettier-config": "^2.0.0",

"husky": "^7.0.4",
"prettier": "^2.5.1",
"prettier-plugin-java": "^1.6.1",
"prettier": "^2.3.0",
"prettier-plugin-java": "^1.0.2",
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
"swiftlint": "^1.0.1",
"typescript": "^4.3.2"
"typescript": "^4.1.5"
},

@@ -42,0 +42,0 @@ "husky": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc