From 24fb11d22f29f6d4797cc27daebe23dfc8ecb2de Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 30 Jan 2023 20:19:16 +0100 Subject: Periodically save watch progress. This makes watch progress survive system crash --- src/QuickMedia.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 433cc77..4de923d 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3321,12 +3321,12 @@ namespace QuickMedia { if(update_duration) { update_duration = false; - successfully_fetched_video_duration = true; + successfully_fetched_video_duration = false; double file_duration = 0.0; video_player->get_duration_in_file(&file_duration); video_info.duration = std::max(video_info.duration, file_duration); - if(video_info.duration > 0.001)// - successfully_fetched_video_duration = true;// + if(video_info.duration > 0.001) + successfully_fetched_video_duration = true; } }; @@ -3346,8 +3346,11 @@ namespace QuickMedia { if(update_time_pos) { update_time_pos = false; - if(video_player->get_time_in_file(&video_time_pos) == VideoPlayer::Error::OK) + if(video_player->get_time_in_file(&video_time_pos) == VideoPlayer::Error::OK) { successfully_fetched_time_pos = true; + if(successfully_fetched_video_duration) + video_page->set_watch_progress(video_time_pos, video_info.duration); + } } update_video_duration_handler(); -- cgit v1.2.3