camera_android_frame 0.10.13
camera_android_frame: ^0.10.13 copied to clipboard
Android implementation of the camera plugin.
camera_android #
The Android implementation of the camera
plugin.
This package provides low-level camera access for the Android platform, used internally by the camera
plugin.
π New Feature: Capture Preview Frame (JPEG) #
This version introduces a new platform method: capturePreviewFrameJpeg()
for retrieving a single JPEG-compressed frame directly from the preview stream, without interrupting camera operation.
β Use Cases #
- Fast frame grabs for lightweight processing
- Preview snapshot without full shutter/photo delay
- Efficient ML/AI input for scanning or inference
- Save current preview frame to file instantly
π§ͺ Streaming Preview Frames (YUV) #
You can also subscribe to a continuous stream of preview frames in YUV format:
πΉ Start / Stop Streaming #
await cameraController.startFrameStream((frame) {
// `frame` is CameraImageData with YUV planes
process(frame);
});
await cameraController.stopFrameStream();
πΈ One-time Preview Frame (YUV) #
To retrieve a single preview frame in YUV format:
final CameraImageData frame = await cameraController.capturePreviewFrame();
// You can access .planes and .width/.height for further processing
πΌ One-time Preview Frame (JPEG) #
To capture and save a single JPEG preview frame:
final String savedPath = await cameraController.capturePreviewFrameJpeg('/path/to/file.jpg');
π How It Works #
- Uses an additional background
ImageReader
(YUV_420_888) - JPEG conversion is done via
YuvImage.compressToJpeg
- Frames are acquired non-blocking to avoid preview freezing
- Safe for use during video recording or preview-only mode
βοΈNotes #
capturePreviewFrameJpeg()
uses internalImageReader
, does not trigger shutter or autofocus- JPEG quality defaults to 90
- Requires Android API 21+