@capacitor-community/camera-preview
Advanced tools
Comparing version 3.1.0 to 4.0.0-0
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 3 instances in 1 package
243
1
262647
51
1
2
+ Added@capacitor/core@4.8.2(transitive)
- Removed@capacitor/core@6.2.0(transitive)
Updated@capacitor/core@^4.0.0