Skip to content

Commit a03c41e

Browse files
committed
修复默认分辨率不存在时会播放最低画质
1 parent 6ff12d4 commit a03c41e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

app/shared/src/main/kotlin/dev/aaa1115910/bv/viewmodel/VideoPlayerV3ViewModel.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,10 @@ class VideoPlayerV3ViewModel(
254254

255255
if (!existDefaultResolution) {
256256
val tempList = resolutionList.sortedByDescending { it.code }
257-
withContext(Dispatchers.Main) { currentQuality = tempList.first() }
258-
tempList.forEach {
259-
if (it <= Prefs.defaultQuality) {
260-
withContext(Dispatchers.Main) { currentQuality = it }
261-
}
257+
val currentQuality = tempList.firstOrNull { it.code < Prefs.defaultQuality.code }
258+
?: tempList.last()
259+
withContext(Dispatchers.Main) {
260+
this@VideoPlayerV3ViewModel.currentQuality = currentQuality
262261
}
263262
}
264263

0 commit comments

Comments
 (0)