isDecoderSupported method
Returns true if the specified decoder is supported by flutter_sound on this platform
Example:
if ( await myPlayer.isDecoderSupported(Codec.opusOGG) ) doSomething;
Implementation
Future<bool> isDecoderSupported(Codec codec) async {
var result = false;
_logger.d('FS:---> isDecoderSupported ');
await _waitOpen();
if (_isInited != Initialized.fullyInitialized) {
throw Exception('Player is not open');
}
// For decoding ogg/opus on ios, we need to support two steps :
// - remux OGG file format to CAF file format (with ffmpeg)
// - decode CAF/OPPUS (with native Apple AVFoundation)
if (_needToConvert(codec)) {
if (!await (flutterSoundHelper.isFFmpegAvailable())) return false;
var convert = kIsWeb
? _tabWebConvert[codec.index]
: (Platform.isIOS)
? _tabIosConvert[codec.index]
: (Platform.isAndroid)
? _tabAndroidConvert[codec.index]
: null;
assert(convert != null);
if (convert != null) {
result = await FlutterSoundPlayerPlatform.instance
.isDecoderSupported(this, codec: convert);
}
} else {
result = await FlutterSoundPlayerPlatform.instance
.isDecoderSupported(this, codec: codec);
}
_logger.d('FS:<--- isDecoderSupported ');
return result;
}