Skip to content

Commit

Permalink
[camerax] Add empty implementation for prepareForVideoRecording not…
Browse files Browse the repository at this point in the history
… used on Android (#6676)

Adds empty implementation for the camera plugin method `prepareForVideoRecording` that is not used on Android.

Prequel to #6629
  • Loading branch information
camsim99 authored May 6, 2024
1 parent c948ff6 commit ca01168
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
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);
});
}

0 comments on commit ca01168

Please sign in to comment.