recordDetection method

void recordDetection()

When the buildCaptureButton's onLongPress called, the recordDetectTimer will be initialized for the press time detection. If the duration reached to same as recordDetectDuration and the timer is still active, start recording video. 当 buildCaptureButton 触发了长按,初始化一个定时器来实现时间检测。如果长按时间 达到了 recordDetectDuration 且定时器未被销毁,则开始录制视频。

Implementation

void recordDetection() {
  recordDetectTimer = Timer(recordDetectDuration, () {
    startRecordingVideo();
    safeSetState(() {});
  });
  setState(() {
    isShootingButtonAnimate = true;
  });
}