trimAudio method

  1. @override
Future<ConversionResult> trimAudio({
  1. required String inputPath,
  2. required String outputPath,
  3. required int startTimeMs,
  4. required int endTimeMs,
  5. required AudioFormat format,
  6. int bitRate = 128,
  7. int sampleRate = 44100,
  8. ProgressCallback? onProgress,
})
override

Trims an audio file to the specified time range

Supports both lossless and lossy trimming modes depending on format compatibility. Lossless trimming preserves original quality when possible.

inputPath - Path to the input audio file outputPath - Path where the trimmed file will be saved startTimeMs - Start time in milliseconds endTimeMs - End time in milliseconds format - Output format (see AudioFormat) bitRate - Target bit rate for lossy trimming (default: 128) sampleRate - Target sample rate for lossy trimming (default: 44100) onProgress - Optional callback for trimming progress (0.0 to 1.0)

Returns ConversionResult with trimmed file information. Throws AudioTrimmingException if trimming fails.

Implementation

@override
Future<ConversionResult> trimAudio({
  required String inputPath,
  required String outputPath,
  required int startTimeMs,
  required int endTimeMs,
  required AudioFormat format,
  int bitRate = 128,
  int sampleRate = 44100,
  ProgressCallback? onProgress,
}) async {
  throw UnsupportedError(
    'Audio trimming is not supported on web platform. '
    'Browser security limitations and lack of file system access prevent '
    'audio file manipulation. Consider using server-side processing or '
    'native platforms for this feature.',
  );
}