From 3eca2373621b4fbd3189df75ada884861536113a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 27 Mar 2021 15:54:37 +0100 Subject: bla --- src/QuickMedia.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index cc89146..a26f52f 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1750,6 +1750,7 @@ namespace QuickMedia { PageType previous_page = pop_page_stack(); std::string video_url = video_page->get_url(); + std::string original_video_url = video_url; bool video_url_is_local = false; if(download_if_streaming_fails) { @@ -1836,7 +1837,7 @@ namespace QuickMedia { } video_player = std::make_unique(use_tor, no_video, use_system_mpv_config, resume_video, is_matrix, video_event_callback, on_window_create, resources_root, get_largest_monitor_height(disp)); - VideoPlayer::Error err = video_player->load_video(video_url_converted.c_str(), window.getSystemHandle(), plugin_name); + VideoPlayer::Error err = video_player->load_video(video_url_converted.c_str(), window.getSystemHandle(), plugin_name, video_title); if(err != VideoPlayer::Error::OK) { std::string err_msg = "Failed to play url: "; err_msg += video_url; @@ -1916,23 +1917,23 @@ namespace QuickMedia { bool cursor_visible = true; sf::Clock cursor_hide_timer; - auto save_video_url_to_clipboard = [&video_url_is_local, &video_url, &video_player_window, &video_player]() { - if(!video_player_window || video_url_is_local) + auto save_video_url_to_clipboard = [&original_video_url, &video_player_window, &video_player]() { + if(!video_player_window) return; - if(video_url_supports_timestamp(video_url)) { + if(video_url_supports_timestamp(original_video_url)) { // TODO: Remove timestamp (&t= or ?t=) from video_url double time_in_file; if(video_player->get_time_in_file(&time_in_file) != VideoPlayer::Error::OK) time_in_file = 0.0; - std::string clipboard = video_url; + std::string clipboard = original_video_url; if((int)time_in_file > 0) clipboard += "&t=" + std::to_string((int)time_in_file); sf::Clipboard::setString(sf::String::fromUtf8(clipboard.begin(), clipboard.end())); } else { - sf::Clipboard::setString(sf::String::fromUtf8(video_url.begin(), video_url.end())); + sf::Clipboard::setString(sf::String::fromUtf8(original_video_url.begin(), original_video_url.end())); } }; @@ -2844,10 +2845,10 @@ namespace QuickMedia { page_stack.push(PageType::IMAGE_BOARD_THREAD); current_page = PageType::VIDEO_CONTENT; watched_videos.clear(); - // TODO: Use real title thread_page->video_url = selected_item->attached_content_url; BodyItems next_items; - video_content_page(thread_page, "No title.webm", true, next_items, 0); + // TODO: Use real title + video_content_page(thread_page, "", true, next_items, 0); redraw = true; } else { if(downloading_image && load_image_future.valid()) @@ -4139,10 +4140,10 @@ namespace QuickMedia { page_stack.push(PageType::CHAT); watched_videos.clear(); current_page = PageType::VIDEO_CONTENT; - // TODO: Add title video_page->url = url; BodyItems next_items; - video_content_page(video_page.get(), "No title", false, next_items, 0); + // TODO: Add title + video_content_page(video_page.get(), "", false, next_items, 0); redraw = true; } else { const char *launch_program = "xdg-open"; @@ -4219,10 +4220,10 @@ namespace QuickMedia { bool is_audio = (message_type == MessageType::AUDIO); bool prev_no_video = no_video; no_video = is_audio; - // TODO: Add title video_page->url = selected->url; BodyItems next_items; - video_content_page(video_page.get(), "No title", message_type == MessageType::VIDEO || message_type == MessageType::AUDIO, next_items, 0); + // TODO: Add title + video_content_page(video_page.get(), "", message_type == MessageType::VIDEO || message_type == MessageType::AUDIO, next_items, 0); no_video = prev_no_video; redraw = true; return true; -- cgit v1.2.3