aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 1ec2c53..723e8ec 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2531,6 +2531,10 @@ namespace QuickMedia {
PageType previous_page = pop_page_stack();
bool video_loaded = false;
+ bool in_seeking = false;
+ sf::Clock seeking_start_timer;
+ const float seeking_restart_timeout_sec = 10.0f; // TODO: Test if this timeout is good on slow hardware such as pinephone and slow internet
+
std::string youtube_video_id_dummy;
const bool is_youtube = youtube_url_extract_id(video_page->get_url(), youtube_video_id_dummy);
const bool is_matrix = strcmp(plugin_name, "matrix") == 0;
@@ -2546,10 +2550,19 @@ namespace QuickMedia {
}
sf::WindowHandle video_player_window = None;
- auto on_window_create = [this, &video_player_window](sf::WindowHandle _video_player_window) mutable {
+ auto on_window_create = [this, &video_player_window, &video_loaded, &in_seeking](sf::WindowHandle _video_player_window) mutable {
video_player_window = _video_player_window;
XSelectInput(disp, video_player_window, KeyPressMask | PointerMotionMask);
XSync(disp, False);
+
+ // Hack to detect video playing if the video starts playing before we have connected to the ipc.
+ // TODO: This is an issue just because of ubuntu shit that uses old mpv that doesn't support ipc over file descriptors.
+ double time_in_file = 0.0;
+ video_player->get_time_in_file(&time_in_file);
+ if(time_in_file > 0.00001) {
+ video_loaded = true;
+ in_seeking = false;
+ }
};
std::unique_ptr<YoutubeMediaProxy> youtube_video_media_proxy;
@@ -2567,9 +2580,7 @@ namespace QuickMedia {
std::string audio_url;
bool has_embedded_audio = true;
- bool in_seeking = false;
- sf::Clock seeking_start_timer;
- const float seeking_restart_timeout_sec = 10.0f; // TODO: Test if this timeout is good on slow hardware such as pinephone and slow internet
+
std::string prev_start_time;
std::vector<MediaChapter> media_chapters;