Skip to content

Commit 19f88ae

Browse files
authored
[camerax] Clarify how CameraX uses preset resolution (#6022)
Improves documentation to clarify that CameraX uses the preset resolution to target for [UseCase]s and are not guaranteed. Fixes flutter/flutter#141766.
1 parent d37fb0a commit 19f88ae

File tree

6 files changed

+25
-8
lines changed

6 files changed

+25
-8
lines changed

packages/camera/camera_android_camerax/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.0+30
2+
3+
* Adds documentation to clarify how the plugin uses resolution presets as target resolutions for CameraX.
4+
15
## 0.5.0+29
26

37
* Modifies `buildPreview` to return `Texture` that maps to camera preview, building in the assumption

packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ class AndroidCameraCameraX extends CameraPlatform {
232232
/// uninitialized camera instance, this method retrieves a
233233
/// [ProcessCameraProvider] instance.
234234
///
235+
/// The specified [resolutionPreset] is the target resolution that CameraX
236+
/// will attempt to select for the [UseCase]s constructed in this method
237+
/// ([preview], [imageCapture], [imageAnalysis], [videoCapture]). If
238+
/// unavailable, a fallback behavior of targeting the next highest resolution
239+
/// will be attempted. See https://developer.android.com/media/camera/camerax/configuration#specify-resolution.
240+
///
235241
/// To return the camera ID, which is equivalent to the ID of the surface texture
236242
/// that a camera preview can be drawn to, a [Preview] instance is configured
237243
/// and bound to the [ProcessCameraProvider] instance.

packages/camera/camera_android_camerax/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera_android_camerax
22
description: Android implementation of the camera plugin using the CameraX library.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
5-
version: 0.5.0+29
5+
version: 0.5.0+30
66

77
environment:
88
sdk: ">=3.0.0 <4.0.0"

packages/camera/camera_platform_interface/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.7.3
2+
3+
* Adds documentation to clarify that platform implementations of the plugin use
4+
resolution presets as target resolutions.
5+
16
## 2.7.2
27

38
* Updates minimum required plugin_platform_interface version to 2.1.7.

packages/camera/camera_platform_interface/lib/src/types/resolution_preset.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,23 @@
44

55
/// Affect the quality of video recording and image capture:
66
///
7-
/// If a preset is not available on the camera being used a preset of lower quality will be selected automatically.
7+
/// A preset is treated as a target resolution, and exact values are not
8+
/// guaranteed. Platform implementations may fall back to a higher or lower
9+
/// resolution if a specific preset is not available.
810
enum ResolutionPreset {
9-
/// 352x288 on iOS, 240p (320x240) on Android and Web
11+
/// 352x288 on iOS, ~240p on Android and Web
1012
low,
1113

12-
/// 480p (640x480 on iOS, 720x480 on Android and Web)
14+
/// ~480p
1315
medium,
1416

15-
/// 720p (1280x720)
17+
/// ~720p
1618
high,
1719

18-
/// 1080p (1920x1080)
20+
/// ~1080p
1921
veryHigh,
2022

21-
/// 2160p (3840x2160 on Android and iOS, 4096x2160 on Web)
23+
/// ~2160p
2224
ultraHigh,
2325

2426
/// The highest resolution available.

packages/camera/camera_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/camera/camera
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 2.7.2
7+
version: 2.7.3
88

99
environment:
1010
sdk: ">=3.0.0 <4.0.0"

0 commit comments

Comments
 (0)