From 79779aff18cb55bb3d61a9dcc2eba3d638c80953 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Wed, 12 Apr 2023 00:30:07 -0500 Subject: [PATCH] VideoPlayer: Update the current timestamp on state changes The state could change and cause a timestamp change without the video frame event firing, which could desync the seek bar from the video's actual time. --- Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp index db7bc3dd86d..03510ecf4cc 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp @@ -135,6 +135,10 @@ void VideoPlayerWidget::open_file(StringView filename) m_playback_manager->on_playback_state_change = [this]() { update_play_pause_icon(); + // If we are seeking, do not set the timestamp, as that will override the seek position. + if (!m_was_playing_before_seek && m_playback_manager->get_state() != Video::PlaybackState::Seeking) { + set_current_timestamp(m_playback_manager->current_playback_time()); + } }; m_playback_manager->on_decoder_error = [this](auto error) {