@@ -187,20 +187,17 @@ class CameraValue {
187187 exposurePointSupported ?? this .exposurePointSupported,
188188 focusPointSupported: focusPointSupported ?? this .focusPointSupported,
189189 deviceOrientation: deviceOrientation ?? this .deviceOrientation,
190- lockedCaptureOrientation:
191- lockedCaptureOrientation == null
192- ? this .lockedCaptureOrientation
193- : lockedCaptureOrientation.orNull,
194- recordingOrientation:
195- recordingOrientation == null
196- ? this .recordingOrientation
197- : recordingOrientation.orNull,
190+ lockedCaptureOrientation: lockedCaptureOrientation == null
191+ ? this .lockedCaptureOrientation
192+ : lockedCaptureOrientation.orNull,
193+ recordingOrientation: recordingOrientation == null
194+ ? this .recordingOrientation
195+ : recordingOrientation.orNull,
198196 isPreviewPaused: isPreviewPaused ?? this .isPreviewPaused,
199197 description: description ?? this .description,
200- previewPauseOrientation:
201- previewPauseOrientation == null
202- ? this .previewPauseOrientation
203- : previewPauseOrientation.orNull,
198+ previewPauseOrientation: previewPauseOrientation == null
199+ ? this .previewPauseOrientation
200+ : previewPauseOrientation.orNull,
204201 );
205202 }
206203
@@ -439,6 +436,10 @@ class CameraController extends ValueNotifier<CameraValue> {
439436
440437 /// Sets the description of the camera.
441438 ///
439+ /// On Android, you must start the recording with [startVideoRecording]
440+ /// with `enablePersistentRecording` set to `true`
441+ /// to avoid cancelling any active recording.
442+ ///
442443 /// Throws a [CameraException] if setting the description fails.
443444 Future <void > setDescription (CameraDescription description) async {
444445 if (value.isRecordingVideo) {
@@ -554,8 +555,15 @@ class CameraController extends ValueNotifier<CameraValue> {
554555 ///
555556 /// The video is returned as a [XFile] after calling [stopVideoRecording] .
556557 /// Throws a [CameraException] if the capture fails.
558+ ///
559+ /// `enablePersistentRecording` parameter configures the recording to be a persistent recording.
560+ /// A persistent recording can only be stopped by explicitly calling [stopVideoRecording]
561+ /// and will ignore events that would normally cause recording to stop,
562+ /// such as lifecycle events or explicit calls to [setDescription] while recording is in progress.
563+ /// Currently a no-op on platforms other than Android.
557564 Future <void > startVideoRecording ({
558565 onLatestImageAvailable? onAvailable,
566+ bool enablePersistentRecording = true ,
559567 }) async {
560568 _throwIfNotInitialized ('startVideoRecording' );
561569 if (value.isRecordingVideo) {
@@ -574,7 +582,11 @@ class CameraController extends ValueNotifier<CameraValue> {
574582
575583 try {
576584 await CameraPlatform .instance.startVideoCapturing (
577- VideoCaptureOptions (_cameraId, streamCallback: streamCallback),
585+ VideoCaptureOptions (
586+ _cameraId,
587+ streamCallback: streamCallback,
588+ enablePersistentRecording: enablePersistentRecording,
589+ ),
578590 );
579591 value = value.copyWith (
580592 isRecordingVideo: true ,
0 commit comments