recordDetection method

void recordDetection()

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

Implementation

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