We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6ff12d4 commit a03c41eCopy full SHA for a03c41e
app/shared/src/main/kotlin/dev/aaa1115910/bv/viewmodel/VideoPlayerV3ViewModel.kt
@@ -254,11 +254,10 @@ class VideoPlayerV3ViewModel(
254
255
if (!existDefaultResolution) {
256
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
- }
+ val currentQuality = tempList.firstOrNull { it.code < Prefs.defaultQuality.code }
+ ?: tempList.last()
+ withContext(Dispatchers.Main) {
+ this@VideoPlayerV3ViewModel.currentQuality = currentQuality
262
}
263
264
0 commit comments