From e81abbde7bce0236e66cf5afd62b3085a9204eb8 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 16 Jun 2023 09:47:28 -0400 Subject: [PATCH] LibWeb: Explicitly set the audio element playback position after seeking The audio element behaves a bit differently than the video element in that the audio element drives itself on a timer (as opposed to LibVideo notifying the video element when a frame is available). So if an audio element is paused while seeking, we wouldn't receive an updated playback position until the element is unpaused. This fixes an issue where you would have to click the play button twice to re-start an audio track after it reached the end. --- Userland/Libraries/LibWeb/HTML/AudioTrack.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp b/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp index 59aa4fb9f0..75a0360941 100644 --- a/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp +++ b/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp @@ -98,6 +98,7 @@ void AudioTrack::seek(double position, MediaSeekMode seek_mode) position = position / duration * static_cast(m_loader->total_samples()); m_loader->seek(position).release_value_but_fixme_should_propagate_errors(); + m_media_element->set_current_playback_position(this->position().to_milliseconds() / 1000.0); } void AudioTrack::update_volume()