mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
fix: songs doesn't play when sources with preferred audio codec is empty (#976)
* Fix song not playing when m4a or weba is not available (one is available but not the other) for that song * Update lib/services/sourced_track/sources/youtube.dart --------- Co-authored-by: Kingkor Roy Tirtho <krtirtho@gmail.com>
This commit is contained in:
parent
02e44fc6b8
commit
ba4e11a40a
@ -79,14 +79,17 @@ class YoutubeSourcedTrack extends SourcedTrack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static SourceMap toSourceMap(StreamManifest manifest) {
|
static SourceMap toSourceMap(StreamManifest manifest) {
|
||||||
final m4a = manifest.audioOnly
|
var m4a = manifest.audioOnly
|
||||||
.where((audio) => audio.codec.mimeType == "audio/mp4")
|
.where((audio) => audio.codec.mimeType == "audio/mp4")
|
||||||
.sortByBitrate();
|
.sortByBitrate();
|
||||||
|
|
||||||
final weba = manifest.audioOnly
|
var weba = manifest.audioOnly
|
||||||
.where((audio) => audio.codec.mimeType == "audio/webm")
|
.where((audio) => audio.codec.mimeType == "audio/webm")
|
||||||
.sortByBitrate();
|
.sortByBitrate();
|
||||||
|
|
||||||
|
m4a = m4a.isEmpty ? weba.toList() : m4a;
|
||||||
|
weba = weba.isEmpty ? m4a.toList() : weba;
|
||||||
|
|
||||||
return SourceMap(
|
return SourceMap(
|
||||||
m4a: SourceQualityMap(
|
m4a: SourceQualityMap(
|
||||||
high: m4a.first.url.toString(),
|
high: m4a.first.url.toString(),
|
||||||
|
Loading…
Reference in New Issue
Block a user