isDecoderSupported method

Future<bool> isDecoderSupported(
  1. TauCodec codec
)

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(TauCodec codec) async {
  var result = false;
  _logger.d('FS:---> isDecoderSupported ');
  await _waitOpen();
  if (!_isInited) {
    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.deprecatedCodec)) {
    if (!tauHelper.isFFmpegAvailable()) return false;
    var convert = kIsWeb
        ? _tabWebConvert[codec.deprecatedCodec.index]
        : (Platform.isIOS)
            ? _tabIosConvert[codec.deprecatedCodec.index]
            : (Platform.isAndroid)
                ? _tabAndroidConvert[codec.deprecatedCodec.index]
                : null;
    assert(convert != null);
    if (convert != null) {
      result = await TauPlayerPlatform.instance
          .isDecoderSupported(this, codec: convert);
    }
  } else {
    result = await TauPlayerPlatform.instance
        .isDecoderSupported(this, codec: codec.deprecatedCodec);
  }
  _logger.d('FS:<--- isDecoderSupported ');
  return result;
}