@lihbr/capacitor-camera2
Capacitor plugin for android.hardware.camera2
inspired from and based on @capacitor-community/camera-preview
all made by an Android amateur.
Install
npm install @lihbr/capacitor-camera2
npx cap sync
API
start(...)
start(options: Camera2Options) => Promise<void>
stop()
stop() => Promise<void>
capture(...)
capture(options: { picturePath: string; thumbnailPath?: string; thumbnailWidth?: number; thumbnailHeight?: number; thumbnailQuality?: number; }) => Promise<void>
Param | Type |
---|
options | { picturePath: string; thumbnailPath?: string; thumbnailWidth?: number; thumbnailHeight?: number; thumbnailQuality?: number; } |
setViewFinderSize(...)
setViewFinderSize(options: { width: number; height: number; }) => Promise<void>
Param | Type |
---|
options | { width: number; height: number; } |
getShutterSpeedRange()
getShutterSpeedRange() => Promise<{ value: [min: number, max: number] | null; }>
Returns: Promise<{ value: [min: number, max: number] | null; }>
setShutterSpeed(...)
setShutterSpeed(options: { value: number; }) => Promise<void>
Param | Type |
---|
options | { value: number; } |
getApertureRange()
getApertureRange() => Promise<{ value: [min: number, max: number] | null; }>
Returns: Promise<{ value: [min: number, max: number] | null; }>
setAperture(...)
setAperture(options: { value: number; }) => Promise<void>
Param | Type |
---|
options | { value: number; } |
getIsoRange()
getIsoRange() => Promise<{ value: [min: number, max: number] | null; }>
Returns: Promise<{ value: [min: number, max: number] | null; }>
setIso(...)
setIso(options: { value: number; }) => Promise<void>
Param | Type |
---|
options | { value: number; } |
getExposureCompensationInfo()
getExposureCompensationInfo() => Promise<{ range: [min: number, max: number] | null; step: number; }>
Returns: Promise<{ range: [min: number, max: number] | null; step: number; }>
setExposureCompensation(...)
setExposureCompensation(options: { value: number; }) => Promise<void>
Param | Type |
---|
options | { value: number; } |
pictureToThumbnail(...)
pictureToThumbnail(options: { picture: string; width: number; height: number; quality?: number; }) => Promise<{ thumbnail: string; }>
Param | Type |
---|
options | { picture: string; width: number; height: number; quality?: number; } |
Returns: Promise<{ thumbnail: string; }>
getExifData(...)
getExifData(options: { path: string; }) => Promise<{ iso: number | null; shutterSpeed: number | null; aperture: number | null; focalLength: number | null; }>
Param | Type |
---|
options | { path: string; } |
Returns: Promise<{ iso: number | null; shutterSpeed: number | null; aperture: number | null; focalLength: number | null; }>
Type Aliases
Camera2Options
{ x?: number; y?: number; width?: number; height?: number; paddingBottom?: number; toBack?: boolean; lockAndroidOrientation?: boolean; }
Contributing
Whether you're helping me fix bugs, improve the docs, or spread the word, I'd love to have you as a contributor!
Asking a question: Open a new topic on GitHub Discussions explaining what you want to achieve / your question. I'll try to get back to you shortly.
Reporting a bug: Open an issue explaining your application's setup and the bug you're encountering.
Suggesting an improvement: Open an issue explaining your improvement or feature so we can discuss and learn more.
Submitting code changes: For small fixes, feel free to open a PR with a description of your changes. For large changes, please first open an issue so we can discuss if and how the changes should be implemented.
License
MIT License © 2024-PRESENT Lucie Haberer