From 59988161a000851a4f0bc90f3fdcfe375571db35 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 6 Aug 2019 17:49:42 +0200 Subject: Restart videoplayer when changing video, to fix loadfile video bug --- src/QuickMedia.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 5de8a0f..d6a369a 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -291,21 +291,24 @@ namespace QuickMedia { } std::vector> related_media = current_plugin->get_related_media(video_url); + bool reload = false; if(video_player) { - video_player->onPlaybackEndedCallback = [this, &related_media, &video_player]() { + video_player->onPlaybackEndedCallback = [this, &related_media, &video_player, &reload]() { if(related_media.empty()) return; video_url = related_media.front()->url; - video_player->load_file(video_url); related_media = current_plugin->get_related_media(video_url); + // TODO: This doesn't seem to work correctly right now, it causes video to become black when changing video (context reset bug). + //video_player->load_file(video_url); + reload = true; }; } sf::Clock resize_timer; sf::Event event; - while (current_page == Page::VIDEO_CONTENT) { + while (current_page == Page::VIDEO_CONTENT && !reload) { while (window.pollEvent(event)) { base_event_handler(event, Page::SEARCH_SUGGESTION); if(event.type == sf::Event::Resized) { -- cgit v1.2.3