getAudioInfo method
Implementation
@override
Future<AudioInfo> getAudioInfo(String path) async {
try {
final result = await methodChannel.invokeMapMethod<String, dynamic>(
'getAudioInfo',
{'path': path},
);
if (result == null) {
throw AudioConversionException('Native getAudioInfo returned null');
}
return AudioInfo(
duration: Duration(milliseconds: result['durationMs'] as int),
sampleRate: result['sampleRate'] as int,
channels: result['channels'] as int,
bitRate: result['bitRate'] as int,
format: result['format'] as String,
);
} on PlatformException catch (e) {
throw AudioConversionException(
e.message ?? 'Unknown error',
details: e.details?.toString(),
);
}
}