Repository navigation
Description
Use case
The problem
On Android, there's a noticeable lag between tapping the shutter and the moment
that's actually captured — even on a static scene it feels slow, and with a moving
subject (kids, pets, sports) the delay means missing the moment outright. Measured
at ~0.6 s on a Galaxy S21 (details below).
On iOS the OS already mitigates this automatically (see below), but apps get no
say: no way to opt out (Apple documents the opt-out — zero-shutter-lag costs
extra memory in the photo output), no way to re-enable it after a session
configuration change silently reverts it, and no way to query it at all.
What the platforms ship today
- Android (CameraX): ships a zero-shutter-lag capture mode, but the plugin
always uses the default latency-minimizing mode — there is no way to turn it on. - iOS (AVFoundation): for apps linked on or after iOS 17, zero-shutter-lag is
enabled automatically when the session configuration supports it — but the
plugin never touches the API, so there is no way to turn it off, back on, or
ask about it.
The same missing API surfaces differently per platform: an opt-in on Android,
explicit control (mostly the documented opt-out) on iOS.
Alternatives considered
No pub.dev package reaches this platform capability — it lives behind
camera_android_camerax/camera_avfoundation themselves, so this is a request
against those.
On-device measurement — Android (Galaxy S21, 5 captures per mode)
Photographed a running millisecond stopwatch; shutter fired via adb shell input tap
(no human reaction time). The stopwatch visible in each saved photo shows how far
behind the shutter tap the captured frame is. Same session, same scene, only the
capture mode changed.
| Captured frame | Shutter → file saved | |
|---|---|---|
Current (MINIMIZE_LATENCY) |
baseline | 912 ms |
ZERO_SHUTTER_LAG |
629 ms earlier | 639 ms |
Run-to-run spread was far below the 629 ms difference, and CameraX's
Selected ZSL size log confirmed the ZSL pipeline was genuinely active.
On-device verification — iOS (iPhone, iOS 26.5)
- With
ResolutionPreset.max:AVCapturePhotoOutput.isZeroShutterLagSupported
reports true, andisZeroShutterLagEnabledis already true before the plugin
touches anything — confirming the iOS 17+ auto-enable. - With
ResolutionPreset.mediumon the same device: unsupported. Support is a
property of the session configuration, not just the device. - Setting
isZeroShutterLagEnabled = falseturns it off; setting it back to
truere-enables it. - What the toggle actually controls, measured at
ResolutionPreset.maxby
comparingAVCapturePhoto.timestampagainst the host-clock time of the
capturePhotocall (5 captures per mode, one warm-up capture discarded):
with ZSL off the saved frame lands +279 ms after the call, with ZSL on
-74 ms before it. Since iOS enables this automatically, that difference
is what an app gives up by opting out — not something this proposal adds.
Proposal
What to add
Explicit zero-shutter-lag control plus a support query on CameraPlatform,
following the existing getSupportedVideoStabilizationModes pattern — defaults
keep today's behavior, so it's non-breaking.
How each platform provides it
- Android:
ImageCapture.CAPTURE_MODE_ZERO_SHUTTER_LAGatImageCaptureconstruction. - iOS:
AVCapturePhotoOutput.isZeroShutterLagEnabled(iOS 17+), guarded byisZeroShutterLagSupported— setting it while unsupported throwsNSInvalidArgumentException, one more reason the support query is part of the API. - Other platforms: report unsupported and ignore the setting.
When it can't be used
- Android: CameraX degrades on its own — flash falls back per shot, devices
without reprocessing never activate the ZSL session. Apps need no special
handling. - iOS: support depends on the session configuration (verified above:
supported atResolutionPreset.max, unsupported atmediumon the same
device), so apps consult the support query and the implementation guards the
write.
Next step
Draft PR with a working implementation for both platforms is up:
flutter/packages#12374 — happy
to reshape the API however maintainers prefer.
Related: #179064 (preview-frame snapshot) attacks the same latency at preview
resolution; this is complementary at full capture resolution.
Activity
[camera_android_camerax] Implement zero-shutter-lag capture
[camera_avfoundation] Implement zero-shutter-lag capture
[camera] Add path-based dependency overrides for combined review
[camera_platform_interface] Add zero-shutter-lag API
[camera_android_camerax] Implement zero-shutter-lag capture
[camera_avfoundation] Implement zero-shutter-lag capture
[camera] Add path-based dependency overrides for combined review
[camera_avfoundation] Implement zero-shutter-lag capture
[camera] Add path-based dependency overrides for combined review
[camera_platform_interface] Add zero-shutter-lag API
[camera_android_camerax] Implement zero-shutter-lag capture
[camera_avfoundation] Implement zero-shutter-lag capture
[camera] Add path-based dependency overrides for combined review
toyaji commentedon Aug 21, 2026
The implementation for both Android and iOS is complete and now up for review in flutter/packages#12374, with the on-device measurements in the PR description.
[camera_platform_interface] Add zero-shutter-lag API (#12996)
[camera] Add zero-shutter-lag support to camera_android_camerax and c…
[camera] Add support for zero-shutter-lag capture (#12374)