convertAudio method
Future<ConversionResult>
convertAudio({
- required String inputPath,
- required String outputPath,
- required AudioFormat format,
- int bitRate = 128,
- int sampleRate = 44100,
- ProgressCallback? onProgress,
override
Converts an audio file to the specified format
Supports converting between various audio formats with customizable quality settings. Uses native platform APIs for optimal performance and compatibility.
inputPath
- Path to the input audio file
outputPath
- Path where the converted file will be saved
format
- Target audio format (see AudioFormat)
bitRate
- Target bit rate in kbps (default: 128)
sampleRate
- Target sample rate in Hz (default: 44100)
onProgress
- Optional callback for conversion progress (0.0 to 1.0)
Returns ConversionResult with output file information. Throws AudioConversionException if conversion fails.
Implementation
@override
Future<ConversionResult> convertAudio({
required String inputPath,
required String outputPath,
required AudioFormat format,
int bitRate = 128,
int sampleRate = 44100,
ProgressCallback? onProgress,
}) async {
throw UnsupportedError(
'Audio conversion is not supported on web platform. '
'Browser security and API limitations prevent direct audio format conversion. '
'Consider using server-side conversion or native platforms for this feature.',
);
}