getUrlFromVideoQualityUrls static method
Future<String>
getUrlFromVideoQualityUrls({
- int? quality,
- required List<
YoutubeVideoQualityUrl> videoUrls,
Get a single YouTube video url from urls.
quality
- integer value of video quality like 720
.
videoUrls
- Actual YouTube video urls.
Implementation
static Future<String> getUrlFromVideoQualityUrls({
int? quality,
required List<YoutubeVideoQualityUrl> videoUrls,
}) async {
final sorted = sortQualityVideoUrls(videoUrls);
if (videoUrls.isEmpty) {
throw Exception('videoQuality cannot be empty');
}
final q = quality ?? sorted[0].quality;
final qualityAndUrl = getQualityUrl(q, sorted);
return qualityAndUrl.url;
}