Skip to content

Commit ca01168

Browse files
authored
[camerax] Add empty implementation for prepareForVideoRecording not used on Android (#6676)
Adds empty implementation for the camera plugin method `prepareForVideoRecording` that is not used on Android. Prequel to #6629
1 parent c948ff6 commit ca01168

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
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.6.4+1
2+
3+
* Adds empty implementation for `prepareForVideoRecording` since this optimization is not used on Android.
4+
15
## 0.6.4
26

37
* Prevents usage of unsupported concurrent `UseCase`s based on the capabiliites of the camera device.

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,15 @@ class AndroidCameraCameraX extends CameraPlatform {
867867
}
868868
}
869869

870+
/// Prepare the capture session for video recording.
871+
///
872+
/// This optimization is not used on Android, so this implementation is a
873+
/// no-op.
874+
@override
875+
Future<void> prepareForVideoRecording() {
876+
return Future<void>.value();
877+
}
878+
870879
/// Configures and starts a video recording. Returns silently without doing
871880
/// anything if there is currently an active recording.
872881
///

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.6.4
5+
version: 0.6.4+1
66

77
environment:
88
sdk: ^3.1.0

packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4040,4 +4040,22 @@ void main() {
40404040
verify(
40414041
camera.processCameraProvider!.unbind(<UseCase>[camera.imageAnalysis!]));
40424042
});
4043+
4044+
test(
4045+
'prepareForVideoRecording does not make any calls involving starting video recording',
4046+
() async {
4047+
final AndroidCameraCameraX camera = AndroidCameraCameraX();
4048+
4049+
// Set directly for test versus calling createCamera.
4050+
camera.processCameraProvider = MockProcessCameraProvider();
4051+
camera.recorder = MockRecorder();
4052+
camera.videoCapture = MockVideoCapture();
4053+
camera.camera = MockCamera();
4054+
4055+
await camera.prepareForVideoRecording();
4056+
verifyNoMoreInteractions(camera.processCameraProvider);
4057+
verifyNoMoreInteractions(camera.recorder);
4058+
verifyNoMoreInteractions(camera.videoCapture);
4059+
verifyNoMoreInteractions(camera.camera);
4060+
});
40434061
}

0 commit comments

Comments
 (0)