From d4e7d0abf9d602c1187db271f9c3c561f8b1a8ae Mon Sep 17 00:00:00 2001 From: Kyrluckechuck Date: Tue, 14 Apr 2026 09:56:28 -0400 Subject: [PATCH] Seek to millisecond rather than flooring to second --- .../java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt | 4 ++-- components/app/AudioPlayer.vue | 3 ++- components/app/AudioPlayerContainer.vue | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt b/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt index 41d7cbf7..9aa133d4 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/plugins/AbsAudioPlayer.kt @@ -325,10 +325,10 @@ class AbsAudioPlayer : Plugin() { @PluginMethod fun seek(call: PluginCall) { - val time:Int = call.getInt("value", 0) ?: 0 // Value in seconds + val time: Double = call.getDouble("value", 0.0) ?: 0.0 // Value in seconds, fractional Log.d(tag, "seek action to $time") Handler(Looper.getMainLooper()).post { - playerNotificationService.seekPlayer(time * 1000L) // convert to ms + playerNotificationService.seekPlayer((time * 1000L).toLong()) call.resolve() } } diff --git a/components/app/AudioPlayer.vue b/components/app/AudioPlayer.vue index 69c1188b..02de28c2 100644 --- a/components/app/AudioPlayer.vue +++ b/components/app/AudioPlayer.vue @@ -615,7 +615,8 @@ export default { this.seekedTime = time this.seekLoading = true - AbsAudioPlayer.seek({ value: Math.floor(time) }) + // Pass fractional seconds so seeks to non-integer chapter starts don't truncate + AbsAudioPlayer.seek({ value: time }) if (this.$refs.playedTrack) { const perc = time / this.totalDuration diff --git a/components/app/AudioPlayerContainer.vue b/components/app/AudioPlayerContainer.vue index 1040e61b..25431761 100644 --- a/components/app/AudioPlayerContainer.vue +++ b/components/app/AudioPlayerContainer.vue @@ -226,7 +226,7 @@ export default { console.log('Already streaming item', startTime) if (startTime !== undefined && startTime !== null) { // seek to start time - AbsAudioPlayer.seek({ value: Math.floor(startTime) }) + AbsAudioPlayer.seek({ value: startTime }) } else if (this.$refs.audioPlayer) { this.$refs.audioPlayer.play() }