isEncoderSupported method
Returns true if the specified encoder is supported by flutter_sound on this platform.
This verb is useful to know if a particular codec is supported on the current platform; Returns a Future
Example:
if ( await myRecorder.isEncoderSupported(Codec.opusOGG) ) doSomething;
isEncoderSupported
is a method for legacy reason, but should be a static function.
Implementation
Future<bool> isEncoderSupported(Codec codec) async {
// For encoding ogg/opus on ios, we need to support two steps :
// - encode CAF/OPPUS (with native Apple AVFoundation)
// - remux CAF file format to OPUS file format (with ffmpeg)
await _waitOpen();
if (_isInited != Initialized.fullyInitialized) {
throw Exception('Recorder is not open');
}
var result = false;
// For encoding ogg/opus on ios, we need to support two steps :
// - encode CAF/OPPUS (with native Apple AVFoundation)
// - remux CAF file format to OPUS file format (with ffmpeg)
result = await FlutterSoundRecorderPlatform.instance
.isEncoderSupported(this, codec: codec);
return result;
}