Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[camerax] Add empty implementation for prepareForVideoRecording not used on Android #6676

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.4+1

* Adds empty implementation for `prepareForVideoRecording` since this optimization is not used on Android.

## 0.6.4

* Prevents usage of unsupported concurrent `UseCase`s based on the capabiliites of the camera device.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,15 @@ class AndroidCameraCameraX extends CameraPlatform {
}
}

/// Prepare the capture session for video recording.
///
/// This optimization is not used on Android, so this implementation is a
/// no-op.
@override
Future<void> prepareForVideoRecording() {
return Future<void>.value();
}

/// Configures and starts a video recording. Returns silently without doing
/// anything if there is currently an active recording.
///
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_android_camerax/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_android_camerax
description: Android implementation of the camera plugin using the CameraX library.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.6.4
version: 0.6.4+1

environment:
sdk: ^3.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4040,4 +4040,22 @@ void main() {
verify(
camera.processCameraProvider!.unbind(<UseCase>[camera.imageAnalysis!]));
});

test(
'prepareForVideoRecording does not make any calls involving starting video recording',
() async {
final AndroidCameraCameraX camera = AndroidCameraCameraX();

// Set directly for test versus calling createCamera.
camera.processCameraProvider = MockProcessCameraProvider();
camera.recorder = MockRecorder();
camera.videoCapture = MockVideoCapture();
camera.camera = MockCamera();

await camera.prepareForVideoRecording();
verifyNoMoreInteractions(camera.processCameraProvider);
verifyNoMoreInteractions(camera.recorder);
verifyNoMoreInteractions(camera.videoCapture);
verifyNoMoreInteractions(camera.camera);
});
}