Skip to content

Commit

Permalink
fix: retry other if no stream found, try fix for #178
Browse files Browse the repository at this point in the history
  • Loading branch information
Malopieds committed Aug 22, 2024
1 parent 346b883 commit 21f6ae6
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,17 @@ class MusicService :
playerResponse.streamingData?.adaptiveFormats?.find {
// Use itag to identify previously played format
it.itag == playedFormat.itag
}
} ?: playerResponse.streamingData
?.adaptiveFormats
?.filter { it.isAudio }
?.maxByOrNull {
it.bitrate *
when (audioQuality) {
AudioQuality.AUTO -> if (connectivityManager.isActiveNetworkMetered) -1 else 1
AudioQuality.HIGH -> 1
AudioQuality.LOW -> -1
} + (if (it.mimeType.startsWith("audio/webm")) 10240 else 0) // prefer opus stream
}
} else {
playerResponse.streamingData
?.adaptiveFormats
Expand Down

0 comments on commit 21f6ae6

Please sign in to comment.