getAudioStreams method

  1. @override
Future<List<Map<String, dynamic>>> getAudioStreams(
  1. String videoId, {
  2. int bitrate = 192,
  3. String? codec,
})
override

Gets audio streams for a YouTube video

Implementation

@override
Future<List<Map<String, dynamic>>> getAudioStreams(
  String videoId, {
  int bitrate = 192,
  String? codec,
}) async {
  try {
    final result = await methodChannel.invokeMethod<List<dynamic>>(
      'getAudioStreams',
      {
        'videoId': videoId,
        'bitrate': bitrate,
        if (codec != null) 'codec': codec,
      },
    );
    return _convertList(result);
  } on PlatformException catch (e) {
    throw PlatformException(
      code: e.code,
      message: e.message,
      details: e.details,
    );
  }
}