getAudioUrl method
Used to get the audio source for a video.
Implementation
Future<String> getAudioUrl(MediaItem item, String dataSource) async {
StreamManifest manifest = getStreamManifest(item);
if (manifest.muxed
.where((e) => e.videoCodec.contains('avc1'))
.map((e) => e.url.toString())
.contains(dataSource)) {
return dataSource;
} else {
AudioStreamInfo streamAudioInfo =
manifest.audioOnly.sortByBitrate().lastWhere((info) {
return info.audioCodec.contains('mp4a');
});
return streamAudioInfo.url.toString();
}
}