Skip to content

Commit c8a76f7

Browse files
committed
⚡️ Enhance video capture on iOS with preparation
1 parent 8212532 commit c8a76f7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/src/widget/camera_picker.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,11 @@ class CameraPickerState extends State<CameraPicker>
333333
/// 在仅允许拍照时不需要启用音频
334334
bool get enableAudio => enableRecording && widget.enableAudio;
335335

336+
/// Whether the picker needs to prepare for video recording on iOS.
337+
/// 是否需要为 iOS 的录制视频执行准备操作
338+
bool get shouldPrepareForVideoRecording =>
339+
enableRecording && enableAudio && Platform.isIOS;
340+
336341
bool get enableSetExposure => widget.enableSetExposure;
337342

338343
bool get enableExposureControlOnPoint => widget.enableExposureControlOnPoint;
@@ -972,6 +977,9 @@ class CameraPickerState extends State<CameraPicker>
972977
const Size innerSize = Size.square(82);
973978
return Listener(
974979
behavior: HitTestBehavior.opaque,
980+
onPointerDown: shouldPrepareForVideoRecording
981+
? (_) => controller.prepareForVideoRecording()
982+
: null,
975983
onPointerUp: enableRecording ? recordDetectionCancel : null,
976984
onPointerMove: enablePullToZoomInRecord
977985
? (PointerMoveEvent e) => onShootingButtonMove(e, constraints)

0 commit comments

Comments
 (0)