Skip to content

Commit

Permalink
Merge branch 'aniyomiorg:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Dark25 authored Jan 17, 2025
2 parents 00b11a6 + 057504d commit 11a62b3
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1164,23 +1164,6 @@ class PlayerActivity : BaseActivity() {
)
}

private fun clearTracks() {
val count = MPVLib.getPropertyInt("track-list/count")!!
// Note that because events are async, properties might disappear at any moment
// so use ?: continue instead of !!
for (i in 0 until count) {
val type = MPVLib.getPropertyString("track-list/$i/type") ?: continue
val mpvId = MPVLib.getPropertyInt("track-list/$i/id") ?: continue
when (type) {
"video" -> MPVLib.command(arrayOf("video-remove", "$mpvId"))
"audio" -> MPVLib.command(arrayOf("audio-remove", "$mpvId"))
"sub" -> MPVLib.command(arrayOf("sub-remove", "$mpvId"))
}
}

viewModel.isLoadingTracks.update { _ -> true }
}

// TODO: exception java.util.ConcurrentModificationException:
// UPDATE: MAY HAVE BEEN FIXED
// at java.lang.Object java.util.ArrayList$Itr.next() (ArrayList.java:860)
Expand All @@ -1190,7 +1173,6 @@ class PlayerActivity : BaseActivity() {
private fun fileLoaded() {
setMpvMediaTitle()
setupPlayerOrientation()
clearTracks()
setupTracks()

// aniSkip stuff
Expand All @@ -1207,6 +1189,8 @@ class PlayerActivity : BaseActivity() {
}

private fun setupTracks() {
viewModel.isLoadingTracks.update { _ -> true }

val audioTracks = viewModel.videoList.value.getOrNull(viewModel.selectedVideoIndex.value)
?.audioTracks?.takeIf { it.isNotEmpty() }
val subtitleTracks = viewModel.videoList.value.getOrNull(viewModel.selectedVideoIndex.value)
Expand Down

0 comments on commit 11a62b3

Please sign in to comment.