From 6758cdc82e4cb295123b0a84819c6a6ebd5ebad0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 15 Jul 2022 12:48:38 +0200 Subject: Youtube: do not autoplay next if starting qm with youtube url, opening youtube url in info page or matrix --- src/QuickMedia.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 147afd9..e710fb5 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1258,7 +1258,7 @@ namespace QuickMedia { tabs.push_back(Tab{std::move(history_body), std::move(history_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); } else { current_page = PageType::VIDEO_CONTENT; - auto youtube_video_page = std::make_unique(this, youtube_url); + auto youtube_video_page = std::make_unique(this, youtube_url, false); video_content_page(nullptr, youtube_video_page.get(), "", false, nullptr, 0); } } else if(strcmp(plugin_name, "peertube") == 0) { @@ -3113,7 +3113,7 @@ namespace QuickMedia { BodyItems related_videos; bool move_in_parent = false; - if(parent_body && video_page->autoplay_next_item() && play_index + 1 >= 0 && play_index + 1 < (int)parent_body->get_num_items()) { + if(parent_body && video_page->autoplay_next_item() && video_page->should_autoplay() && play_index + 1 >= 0 && play_index + 1 < (int)parent_body->get_num_items()) { parent_body->copy_range(play_index + 1, (size_t)-1, related_videos); move_in_parent = true; } @@ -3568,6 +3568,12 @@ namespace QuickMedia { } else if(update_err == VideoPlayer::Error::EXITED && video_player->exit_status == 0 && (!is_matrix || is_youtube)) { std::string new_video_url; + if(!video_page->should_autoplay()) { + current_page = previous_page; + go_to_previous_page = true; + break; + } + if(related_videos_task.valid()) { TaskResult task_result = run_task_with_loading_screen([&]() { while(!program_is_dead_in_current_thread()) { @@ -6270,7 +6276,7 @@ namespace QuickMedia { watched_videos.clear(); page_stack.push(PageType::CHAT); current_page = PageType::VIDEO_CONTENT; - auto youtube_video_page = std::make_unique(this, std::move(url)); + auto youtube_video_page = std::make_unique(this, std::move(url), false); // TODO: Use real title video_content_page(matrix_chat_page, youtube_video_page.get(), "", false, tabs[MESSAGES_TAB_INDEX].body.get(), tabs[MESSAGES_TAB_INDEX].body->get_selected_item()); redraw = true; -- cgit v1.2.3