timeLeftRecording function

void timeLeftRecording(
  1. TimeLeftRecordingOptions options
)

Displays an alert message indicating the remaining time left for recording.

@param TimeLeftRecordingOptions options - Options for managing time left for recording.

  • timeLeft: Remaining time in seconds.
  • showAlert: Optional callback to display an alert.

@example

final options = TimeLeftRecordingOptions(
  timeLeft: 30,
  showAlert: (message, type, duration) => print("Alert: $message"),
);
timeLeftRecording(options);
// Output: "The recording will stop in less than 30 seconds."

Implementation

void timeLeftRecording(TimeLeftRecordingOptions options) {
  try {
    options.showAlert?.call(
      message:
          'The recording will stop in less than ${options.timeLeft} seconds.',
      duration: 3000,
      type: 'danger',
    );
  } catch (error) {
    if (kDebugMode) {
      print("Error in timeLeftRecording: $error");
    }
  }
}