fix audio formats sorting not selecting preferred format id when showing generics

This commit is contained in:
deniscerri 2025-05-26 22:15:53 +02:00
parent 733e33ba78
commit ffc4ded5af
No known key found for this signature in database
GPG key ID: 95C43D517D830350

View file

@ -528,7 +528,9 @@ class DownloadViewModel(private val application: Application) : AndroidViewModel
Type.audio -> {
return cloneFormat (
try {
val theFormats = formats.filter { it.vcodec.isBlank() || it.vcodec == "none" }
val theFormats = formats.filter { it.vcodec.isBlank() || it.vcodec == "none" }.ifEmpty {
formatUtil.getGenericAudioFormats(resources).sortedByDescending { it.filesize }
}
FormatUtil(application).sortAudioFormats(theFormats).first()
}catch (e: Exception){
formatUtil.getGenericAudioFormats(resources).first()