startCustomRecording method

void startCustomRecording({
  1. Duration interval = const Duration(seconds: 1),
})

Implementation

void startCustomRecording({Duration interval = const Duration(seconds: 1)}) {
  _customTimer?.cancel(); // Cancel if any previous timer exists
  _customTimerSubject.add(0); // Reset timer to 0 seconds

  // Start custom timer
  _customTimer = Timer.periodic(const Duration(seconds: 1), (_) {
    final int currentSeconds = _customTimerSubject.value + 1;
    _customTimerSubject.add(currentSeconds); // Update elapsed time
  });

  // Start capturing frames at specified intervals
  Timer.periodic(interval, (_) async {
    await _captureCustomRecordingFrame();
  });
}