-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[camera] Implement setDescription with android camerax #10117
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
base: main
Are you sure you want to change the base?
Changes from 8 commits
fc9055e
04109c8
3c536a4
8126aef
d5840c2
c42b716
07aa9db
38dbb0b
a088450
53c562b
96fd73c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -439,6 +439,10 @@ class CameraController extends ValueNotifier<CameraValue> { | |||||
|
|
||||||
| /// Sets the description of the camera. | ||||||
| /// | ||||||
| /// On Android, you must start the recording with [startVideoRecording] | ||||||
| /// with `enablePersistentRecording` set to `true` | ||||||
| /// to avoid cancelling any active recording. | ||||||
| /// | ||||||
| /// Throws a [CameraException] if setting the description fails. | ||||||
| Future<void> setDescription(CameraDescription description) async { | ||||||
| if (value.isRecordingVideo) { | ||||||
|
|
@@ -554,8 +558,15 @@ class CameraController extends ValueNotifier<CameraValue> { | |||||
| /// | ||||||
| /// The video is returned as a [XFile] after calling [stopVideoRecording]. | ||||||
| /// Throws a [CameraException] if the capture fails. | ||||||
| /// | ||||||
| /// `enablePersistentRecording` parameter configures the recording to be a persistent recording. | ||||||
| /// A persistent recording can only be stopped by explicitly calling [stopVideoRecording] | ||||||
| /// and will ignore events that would normally cause recording to stop, | ||||||
| /// such as lifecycle events or explicit calls to [setDescription] while recording is in progress. | ||||||
| /// Currently a no-op on platforms other than Android. | ||||||
| Future<void> startVideoRecording({ | ||||||
| onLatestImageAvailable? onAvailable, | ||||||
| bool enablePersistentRecording = true, | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting For a patch release, it's best to avoid such breaking changes. I recommend changing the default value to If you apply this change, please remember to update the integration test in
Suggested change
|
||||||
| }) async { | ||||||
| _throwIfNotInitialized('startVideoRecording'); | ||||||
| if (value.isRecordingVideo) { | ||||||
|
|
@@ -574,7 +585,11 @@ class CameraController extends ValueNotifier<CameraValue> { | |||||
|
|
||||||
| try { | ||||||
| await CameraPlatform.instance.startVideoCapturing( | ||||||
| VideoCaptureOptions(_cameraId, streamCallback: streamCallback), | ||||||
| VideoCaptureOptions( | ||||||
| _cameraId, | ||||||
| streamCallback: streamCallback, | ||||||
| enablePersistentRecording: enablePersistentRecording, | ||||||
| ), | ||||||
| ); | ||||||
| value = value.copyWith( | ||||||
| isRecordingVideo: true, | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor optional nit: