RecorderConfiguration constructor

RecorderConfiguration({
  1. required DataSource dataSource,
  2. String logsDir = '',
  3. Map<HardwareSpecification, String>? hardwareSpecifications,
  4. List<DataType> recordedTypes = const <DataType>[],
  5. int minDurationSeconds = 30,
  6. Resolution videoQuality = Resolution.unknown,
  7. int chunkDurationSeconds = 0,
  8. bool continuousRecording = true,
  9. bool enableAudio = false,
  10. int maxDiskSpaceUsed = 0,
  11. int keepMinSeconds = 0,
  12. bool deleteOlderThanKeepMin = false,
  13. RecordingTransportMode transportMode = RecordingTransportMode.unknown,
})

Creates a configured RecorderConfiguration.

Use this factory to prepare recorder settings before creating a Recorder instance. The constructor only builds the configuration; it does not start or modify any active recorder by itself.

Parameters

  • dataSource: The data source used for recording. Required.
  • logsDir: Absolute path to the directory used to store recorded logs. Defaults to an empty string.
  • hardwareSpecifications: Optional map of device metadata keyed by HardwareSpecification.
  • recordedTypes: List of DataType values to record. If a requested type is not produced by the dataSource, recording will not start. Defaults to an empty list.
  • minDurationSeconds: Minimum duration (seconds) a recording must reach to be saved. Defaults to 30.
  • videoQuality: Video resolution used when DataType.camera is recorded. Defaults to Resolution.unknown.
  • chunkDurationSeconds: Split recordings into chunks of this many seconds. 0 disables chunking. Defaults to 0.
  • continuousRecording: If true, a new recording starts automatically when a chunk ends. Defaults to true.
  • enableAudio: Enable audio tracks for recordings. Defaults to false.
  • maxDiskSpaceUsed: Maximum disk space in bytes that recordings may occupy. 0 disables disk checks. Defaults to 0.
  • keepMinSeconds: Minimum seconds of recordings to retain on disk. Defaults to 0.
  • deleteOlderThanKeepMin: If true, older logs are deleted once keepMinSeconds is exceeded. Defaults to false.
  • transportMode: Transport mode associated with recorded logs. Defaults to RecordingTransportMode.unknown.

Returns

Implementation

factory RecorderConfiguration({
  required DataSource dataSource,
  String logsDir = '',
  Map<HardwareSpecification, String>? hardwareSpecifications,
  List<DataType> recordedTypes = const <DataType>[],
  int minDurationSeconds = 30,
  Resolution videoQuality = Resolution.unknown,
  int chunkDurationSeconds = 0,
  bool continuousRecording = true,
  bool enableAudio = false,
  int maxDiskSpaceUsed = 0,
  int keepMinSeconds = 0,
  bool deleteOlderThanKeepMin = false,
  RecordingTransportMode transportMode = RecordingTransportMode.unknown,
}) {
  final RecorderConfiguration result = RecorderConfiguration._create();

  result.dataSource = dataSource;
  result.logsDir = logsDir;
  result.recordedTypes = recordedTypes;
  if (hardwareSpecifications != null) {
    result.hardwareSpecifications = hardwareSpecifications;
  }
  result.minDurationSeconds = minDurationSeconds;
  result.videoQuality = videoQuality;
  result.chunkDurationSeconds = chunkDurationSeconds;
  result.continuousRecording = continuousRecording;
  result.enableAudio = enableAudio;
  result.maxDiskSpaceUsed = maxDiskSpaceUsed;
  result.keepMinSeconds = keepMinSeconds;
  result.deleteOlderThanKeepMin = deleteOlderThanKeepMin;
  result.transportMode = transportMode;

  return result;
}