Skip to main content Link Menu Expand (external link) Document Search Copy Copied
isEncoderSupported method - FlutterSoundRecorder class - recorder library - Dart API
menu
isEncoderSupported

isEncoderSupported method

Future<bool> isEncoderSupported(
  1. Codec codec
)

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;. Note: isEncoderSupported is a method for internal reason, but should be a static function.

Parameter

  • codec: the codec that you want to test.

Return

  • Returns true if the encoder is supported for this codec.

Example

        if ( await myRecorder.isEncoderSupported(Codec.opusOGG) ) doSomething;

Implementation

Future<bool> isEncoderSupported(Codec codec) async {
  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;
}
flutter_sound 9.25.3