diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 68e9973d5..99d514952 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -4184,8 +4184,9 @@ inputStoryAreas areas:vector = InputStoryAreas; //@minithumbnail Video minithumbnail; may be null //@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null //@preload_prefix_size Size of file prefix, which is supposed to be preloaded, in bytes +//@main_frame_timestamp Timestamp of the frame, used as video thumbnail //@video File containing the video -storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 video:file = StoryVideo; +storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 main_frame_timestamp:double video:file = StoryVideo; //@class StoryContent @description Contains the content of a story diff --git a/td/telegram/DocumentsManager.cpp b/td/telegram/DocumentsManager.cpp index 54399f683..b8e8a0915 100644 --- a/td/telegram/DocumentsManager.cpp +++ b/td/telegram/DocumentsManager.cpp @@ -125,12 +125,14 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo double video_precise_duration = 0.0; int32 video_duration = 0; int32 video_preload_prefix_size = 0; + double video_start_ts = 0.0; string video_waveform; if (video != nullptr) { video_precise_duration = video->duration_; video_duration = static_cast(std::ceil(video->duration_)); if (document_subtype == Subtype::Story) { video_preload_prefix_size = video->preload_prefix_size_; + video_start_ts = video->video_start_ts_; } video_is_animation = video->nosound_; auto video_dimensions = get_dimensions(video->w_, video->h_, "documentAttributeVideo"); @@ -543,7 +545,7 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo td_->videos_manager_->create_video( file_id, std::move(minithumbnail), std::move(thumbnail), std::move(animated_thumbnail), has_stickers, vector(), std::move(file_name), std::move(mime_type), video_duration, video_precise_duration, - dimensions, supports_streaming, video_is_animation, video_preload_prefix_size, !is_web); + dimensions, supports_streaming, video_is_animation, video_preload_prefix_size, video_start_ts, !is_web); break; case Document::Type::VideoNote: td_->video_notes_manager_->create_video_note(file_id, std::move(minithumbnail), std::move(thumbnail), diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index c1654a11a..89c153b3e 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -2992,7 +2992,7 @@ static Result create_input_message_content( std::move(sticker_file_ids), std::move(file_name), std::move(mime_type), input_video->duration_, input_video->duration_, get_dimensions(input_video->width_, input_video->height_, nullptr), - input_video->supports_streaming_, false, 0, false); + input_video->supports_streaming_, false, 0, 0.0, false); content = make_unique(file_id, std::move(caption), input_video->has_spoiler_ && !is_secret); break; diff --git a/td/telegram/MessageExtendedMedia.cpp b/td/telegram/MessageExtendedMedia.cpp index 54ea02fb3..6f0473109 100644 --- a/td/telegram/MessageExtendedMedia.cpp +++ b/td/telegram/MessageExtendedMedia.cpp @@ -164,10 +164,11 @@ Result MessageExtendedMedia::get_message_extended_media( string mime_type = MimeType::from_extension(path_view.extension()); bool has_stickers = !sticker_file_ids.empty(); - td->videos_manager_->create_video( - file_id, string(), std::move(thumbnail), AnimationSize(), has_stickers, std::move(sticker_file_ids), - std::move(file_name), std::move(mime_type), type->duration_, type->duration_, - get_dimensions(paid_media->width_, paid_media->height_, nullptr), type->supports_streaming_, false, 0, false); + td->videos_manager_->create_video(file_id, string(), std::move(thumbnail), AnimationSize(), has_stickers, + std::move(sticker_file_ids), std::move(file_name), std::move(mime_type), + type->duration_, type->duration_, + get_dimensions(paid_media->width_, paid_media->height_, nullptr), + type->supports_streaming_, false, 0, 0.0, false); result.video_file_id_ = file_id; break; } diff --git a/td/telegram/StoryContent.cpp b/td/telegram/StoryContent.cpp index a76093128..ce08f187a 100644 --- a/td/telegram/StoryContent.cpp +++ b/td/telegram/StoryContent.cpp @@ -290,10 +290,10 @@ Result> get_input_story_content( auto sticker_file_ids = td->stickers_manager_->get_attached_sticker_file_ids(input_story->added_sticker_file_ids_); bool has_stickers = !sticker_file_ids.empty(); - td->videos_manager_->create_video(file_id, string(), PhotoSize(), AnimationSize(), has_stickers, - std::move(sticker_file_ids), "story.mp4", "video/mp4", - static_cast(std::ceil(input_story->duration_)), input_story->duration_, - get_dimensions(720, 1280, nullptr), true, input_story->is_animation_, 0, false); + td->videos_manager_->create_video( + file_id, string(), PhotoSize(), AnimationSize(), has_stickers, std::move(sticker_file_ids), "story.mp4", + "video/mp4", static_cast(std::ceil(input_story->duration_)), input_story->duration_, + get_dimensions(720, 1280, nullptr), true, input_story->is_animation_, 0, 0.0, false); return make_unique(file_id, FileId()); } diff --git a/td/telegram/VideosManager.cpp b/td/telegram/VideosManager.cpp index 2527aded5..57f065a12 100644 --- a/td/telegram/VideosManager.cpp +++ b/td/telegram/VideosManager.cpp @@ -21,6 +21,8 @@ #include "td/utils/misc.h" #include "td/utils/Status.h" +#include + namespace td { VideosManager::VideosManager(Td *td) : td_(td) { @@ -65,7 +67,7 @@ td_api::object_ptr VideosManager::get_story_video_object(Fil return td_api::make_object( video->precise_duration, video->dimensions.width, video->dimensions.height, video->has_stickers, video->is_animation, get_minithumbnail_object(video->minithumbnail), std::move(thumbnail), - video->preload_prefix_size, td_->file_manager_->get_file_object(file_id)); + video->preload_prefix_size, video->start_ts, td_->file_manager_->get_file_object(file_id)); } FileId VideosManager::on_get_video(unique_ptr