From d3a0e09f9cd4a4f3ff76b3c0dd7202b1694badb9 Mon Sep 17 00:00:00 2001 From: Antoine Jaury Date: Sat, 5 Sep 2026 16:45:55 +0200 Subject: [PATCH] fix: correct seeking to a sentence on web --- CHANGELOG.md | 1 + .../kotlin/bzh/ajaury/chombev/player/data/WebAudioPlayer.kt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 995c661..4770d55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Desktop: audio playback failed with *Failed to play audio* on every record, because the JDK cannot decode the `.m4a` (AAC) recordings on its own. - add emoji fallback for web +- correct seeking to a sentence on web ## [1.0.0-alpha02] - 2026-08-04 diff --git a/core/audioplayer/src/webMain/kotlin/bzh/ajaury/chombev/player/data/WebAudioPlayer.kt b/core/audioplayer/src/webMain/kotlin/bzh/ajaury/chombev/player/data/WebAudioPlayer.kt index 8b391e2..b8f6213 100644 --- a/core/audioplayer/src/webMain/kotlin/bzh/ajaury/chombev/player/data/WebAudioPlayer.kt +++ b/core/audioplayer/src/webMain/kotlin/bzh/ajaury/chombev/player/data/WebAudioPlayer.kt @@ -24,7 +24,8 @@ internal class WebAudioPlayer : AudioPlayer { get() = (audio?.duration?.takeIf { it.isFinite() } ?: 0.0).seconds override fun seekTo(position: Duration) { - audio?.currentTime = position.inWholeMicroseconds.toDouble() + audio?.currentTime = position.inWholeMilliseconds.toDouble() / 1000 + audio?.play() } override fun load(uri: String) {