isFormatSupported method

  1. @override
Future<bool> isFormatSupported(
  1. String inputPath
)
override

Checks if the given audio format is supported for processing

inputPath - Path to the audio file to check

Returns true if the format is supported, false otherwise.

Implementation

@override
Future<bool> isFormatSupported(String inputPath) async {
  _validateFilePath(inputPath, 'inputPath');

  try {
    final result = await methodChannel
        .invokeMethod<bool>('isFormatSupported', {'inputPath': inputPath})
        .timeout(const Duration(seconds: 10));

    return result ?? false;
  } on PlatformException catch (e) {
    if (e.code == 'PLATFORM_NOT_SUPPORTED') {
      return false;
    }
    throw _convertPlatformException(e, AudioAnalysisException.new, {
      'inputPath': inputPath,
    });
  } catch (e) {
    return false;
  }
}