From a119460f0bc9854b2fe45114deb1820ea1db7f30 Mon Sep 17 00:00:00 2001 From: perokhe <81130286+perokhe@users.noreply.github.com> Date: Thu, 19 Sep 2024 04:24:34 -0600 Subject: [PATCH] fix(player): Episode progress not being saved (#1784) --- .../java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt index f0428847db..082ddcb1b9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt @@ -1827,7 +1827,7 @@ class PlayerActivity : BaseActivity() { val tracks = streams.subtitle.tracks.toList() val preferredIndex = subtitleSelect.getPreferredSubtitleIndex(tracks) ?: let { - val mpvSub = player.tracks["sub"]?.firstOrNull { player.sid == it.mpvId } + val mpvSub = player.tracks["sub"]?.toTypedArray()?.firstOrNull { player.sid == it.mpvId } mpvSub?.let { streams.subtitle.tracks.indexOfFirst { it.url == mpvSub.mpvId.toString() } }?.coerceAtLeast(0) ?: 0 @@ -1861,8 +1861,7 @@ class PlayerActivity : BaseActivity() { MPVLib.command(arrayOf("audio-add", audio.url, "select", audio.url)) } } ?: run { - val mpvAudio = player.tracks.getOrElse("audio") { emptyList() } - .firstOrNull { player.aid == it.mpvId } + val mpvAudio = player.tracks["audio"]?.toTypedArray()?.firstOrNull { player.aid == it.mpvId } streams.audio.index = mpvAudio?.let { streams.audio.tracks.indexOfFirst { it.url == mpvAudio.mpvId.toString() } }?.coerceAtLeast(0) ?: 0