diff --git a/.changes/add-camera-controls.md b/.changes/add-camera-controls.md new file mode 100644 index 0000000..84e884e --- /dev/null +++ b/.changes/add-camera-controls.md @@ -0,0 +1,9 @@ +--- +"tauri-plugin-camera-kessdev": "minor" +"tauri-plugin-camera-kessdev-js": "minor" +--- + +Add fine camera controls: torch (continuous light), tap-to-focus and focus mode, +exposure compensation and mode, and white balance (mode + Kelvin temperature). +Extend `getCapabilities()` with `exposureRange`, `exposureModes` and +`whiteBalanceModes`. diff --git a/.changes/add-camera-lens-selection.md b/.changes/add-camera-lens-selection.md new file mode 100644 index 0000000..4b01a8f --- /dev/null +++ b/.changes/add-camera-lens-selection.md @@ -0,0 +1,8 @@ +--- +"tauri-plugin-camera-kessdev": "minor" +"tauri-plugin-camera-kessdev-js": "minor" +--- + +Add `startPreview({ cameraId })` to open the preview with a specific camera/lens +(id from `getAvailableCameras()`); `cameraId` takes precedence over `camera` +(front/back). diff --git a/.changes/add-capture-config.md b/.changes/add-capture-config.md new file mode 100644 index 0000000..8bceb8f --- /dev/null +++ b/.changes/add-capture-config.md @@ -0,0 +1,8 @@ +--- +"tauri-plugin-camera-kessdev": "minor" +"tauri-plugin-camera-kessdev-js": "minor" +--- + +Add capture configuration: `capture({ resolution, aspectRatio, format, quality })` +and `startRecording({ quality, fps, bitrate })`. Extend `getCapabilities()` with +`photoResolutions`, `photoAspects`, `videoQualities` and `videoFps`. diff --git a/README.md b/README.md index e5e8270..ba78491 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ A [Tauri v2](https://v2.tauri.app) plugin that provides a **unified JavaScript API** for camera access across Android, iOS and desktop. It supports live preview, photo capture, -video recording (with audio), camera controls (front/back, flash, zoom), saving to the +video recording (with audio), camera controls (front/back, flash, zoom), camera +introspection (list the available cameras and query their capabilities), saving to the photo gallery, and camera permission management. | Platform | Supported | @@ -25,7 +26,7 @@ Add the Rust crate to `src-tauri/Cargo.toml`: ```toml [dependencies] -tauri-plugin-camera-kessdev = "0.1.0" +tauri-plugin-camera-kessdev = "0.2.0-beta.0" # beta # or from a git/path source: # tauri-plugin-camera-kessdev = { path = "../tauri-plugin-camera" } ``` @@ -61,15 +62,16 @@ Add the default permission set to `src-tauri/capabilities/default.json`: { "permissions": [ "core:default", - "camera:default" + "camera-kessdev:default" ] } ``` To allow only specific commands, use the granular permissions instead of -`camera:default` (e.g. `camera:allow-capture`, `camera:allow-start-recording`, -`camera:allow-check-permissions`, …). The full list is generated under -`permissions/autogenerated/commands/` as `allow-` / `deny-`. +`camera-kessdev:default` (e.g. `camera-kessdev:allow-capture`, +`camera-kessdev:allow-start-recording`, `camera-kessdev:allow-check-permissions`, …). +The full list is generated under `permissions/autogenerated/commands/` as +`allow-` / `deny-`. ### Android @@ -135,6 +137,7 @@ import { saveToGallery, checkPermissions, requestPermissions, + openAppSettings, getPreviewStream, convertFileSrc } from 'tauri-plugin-camera-kessdev' @@ -146,6 +149,10 @@ import { // windowed: true keeps the webview transparent so your UI renders over the camera. await startPreview({ camera: 'back', windowed: true }) +// Or pick a specific lens by id (from getAvailableCameras()); cameraId takes precedence. +const cameras = await getAvailableCameras() +await startPreview({ cameraId: cameras[0].id }) + // Desktop: attach the stream to a