diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-01-30 20:19:16 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-01-30 20:19:16 +0100 |
commit | 24fb11d22f29f6d4797cc27daebe23dfc8ecb2de (patch) | |
tree | 547f7feb4fd9e2f7031dc9e19c7a5155debf7131 /src | |
parent | 5c854e116785a2c0c261d5f83c159c34e71fe718 (diff) |
Periodically save watch progress. This makes watch progress survive system crash
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
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(); |