From d281b7371dfaed7f8fe43442672debd41b616bd2 Mon Sep 17 00:00:00 2001 From: MUEDSA <7676275+muedsa@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:38:04 +0800 Subject: [PATCH] update: record progress complete when player ended --- .../com/muedsa/agetv/ui/features/playback/PlaybackScreen.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/kotlin/com/muedsa/agetv/ui/features/playback/PlaybackScreen.kt b/app/src/main/kotlin/com/muedsa/agetv/ui/features/playback/PlaybackScreen.kt index 63f5c5d..81c73b6 100644 --- a/app/src/main/kotlin/com/muedsa/agetv/ui/features/playback/PlaybackScreen.kt +++ b/app/src/main/kotlin/com/muedsa/agetv/ui/features/playback/PlaybackScreen.kt @@ -62,6 +62,12 @@ fun PlaybackScreen( LaunchedEffect(key1 = playerEnd) { if (playerEnd) { + if (episodeProgress.aid == aid && exoplayerHolder != null) { + val exoPlayer = exoplayerHolder!! + episodeProgress.duration = exoPlayer.duration + episodeProgress.updateAt = System.currentTimeMillis() + playbackViewModel.saveEpisodeProgress(episodeProgress) + } errorMsgBoxState.error("播放结束,即将返回") delay(3_000) activity?.finish()