diff --git a/.changes/native-desktop-recording.md b/.changes/native-desktop-recording.md new file mode 100644 index 0000000..3b46955 --- /dev/null +++ b/.changes/native-desktop-recording.md @@ -0,0 +1,10 @@ +--- +"tauri-plugin-camera-kessdev": "minor" +"tauri-plugin-camera-kessdev-js": "minor" +--- + +Add an opt-in native desktop camera backend (Cargo feature `native-desktop`, +cross-platform GStreamer); it owns the camera and captures once, fanning out to a +live preview (JPEG frames delivered to the frontend) and a native encoder, so the UI +is not blocked and `stopRecording()` does not freeze. Expose `startPreview({ onFrame })`, +the `PreviewFrame` type and `getCapabilities().supportsNativeRecording`. diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 9f2bcd0..692278f 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -26,7 +26,9 @@ jobs: librsvg2-dev \ libxdo-dev \ libssl-dev \ - build-essential + build-essential \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev - name: format run: cargo fmt --all -- --check @@ -37,6 +39,12 @@ jobs: - name: test run: cargo test + - name: clippy (native desktop) + run: cargo clippy --features native-desktop --all-targets -- -D warnings + + - name: test (native desktop) + run: cargo test --features native-desktop + - name: check mobile target run: cargo check --target aarch64-linux-android diff --git a/Cargo.toml b/Cargo.toml index 2f8391b..64d0a8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,11 +10,21 @@ rust-version = "1.77.2" exclude = ["/examples", "/dist-js", "/guest-js", "/node_modules", "/.changes", "/.github"] links = "tauri-plugin-camera-kessdev" +[features] +default = [] +# Native desktop camera backend (capture -> preview frames + native encoder). +# Off by default to avoid requiring the platform dev libraries (e.g. GStreamer +# on Linux) for every build. +native-desktop = ["dep:gstreamer", "dep:gstreamer-app", "dep:base64"] + [dependencies] tauri = { version = "2.11.3" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "2" +base64 = { version = "0.22", optional = true } +gstreamer = { version = "0.23", optional = true } +gstreamer-app = { version = "0.23", optional = true } [target.'cfg(target_os = "windows")'.dependencies] webview2-com = "0.39" diff --git a/README.md b/README.md index 75293cd..f468974 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,36 @@ preview's video track (only the microphone is acquired separately), so the `