Skip to content

Commit

Permalink
Choose audio stream with highest quality
Browse files Browse the repository at this point in the history
  • Loading branch information
0xf4b1 committed Dec 23, 2023
1 parent 7aae907 commit 8591c10
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,7 @@ class Plugin(appContext: Context, context: Context) : IPlugin {
private fun getAudioStream(url: String): String {
val extractor = YouTube.getStreamExtractor(url)
extractor.fetchPage()
for (stream in extractor.audioStreams) {
if (stream.format!!.getName() == "m4a") {
return stream.content.replace("signature", "sig")
}
}
throw IllegalStateException("no audio stream")
return extractor.audioStreams.maxBy { it.averageBitrate }.content
}

override fun getIcon(): Bitmap = icon
Expand Down

0 comments on commit 8591c10

Please sign in to comment.