mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 16:10:20 +00:00
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.
This commit is contained in:
parent
dc049e36cf
commit
79779aff18
Notes:
sideshowbarker
2024-07-16 21:28:11 +09:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/SerenityOS/serenity/commit/79779aff18 Pull-request: https://github.com/SerenityOS/serenity/pull/18300 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/trflynn89
1 changed files with 4 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue