Add inputStoryContentVideo.main_frame_timestamp.

This commit is contained in:
levlam 2024-07-16 16:34:13 +03:00
parent ac90866224
commit 1c3672cdc6
4 changed files with 20 additions and 12 deletions

View File

@ -4212,8 +4212,9 @@ inputStoryContentPhoto photo:InputFile added_sticker_file_ids:vector<int32> = In
//@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second
//@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable
//@duration Precise duration of the video, in seconds; 0-60
//@main_frame_timestamp Timestamp of the frame, which will be used as video thumbnail
//@is_animation True, if the video has no sound
inputStoryContentVideo video:InputFile added_sticker_file_ids:vector<int32> duration:double is_animation:Bool = InputStoryContent;
inputStoryContentVideo video:InputFile added_sticker_file_ids:vector<int32> duration:double main_frame_timestamp:double is_animation:Bool = InputStoryContent;
//@class StoryList @description Describes a list of stories

View File

@ -282,18 +282,22 @@ Result<unique_ptr<StoryContent>> get_input_story_content(
auto input_story = static_cast<const td_api::inputStoryContentVideo *>(input_story_content.get());
TRY_RESULT(file_id, td->file_manager_->get_input_file_id(FileType::Video, input_story->video_, owner_dialog_id,
false, false));
file_id =
td->file_manager_->copy_file_id(file_id, FileType::VideoStory, owner_dialog_id, "get_input_story_content");
if (input_story->duration_ < 0 || input_story->duration_ > 60.0) {
return Status::Error(400, "Invalid video duration specified");
}
if (input_story->main_frame_timestamp_ < 0.0) {
return Status::Error(400, "Wrong main frame timestamp specified");
}
file_id =
td->file_manager_->copy_file_id(file_id, FileType::VideoStory, owner_dialog_id, "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<int32>(std::ceil(input_story->duration_)), input_story->duration_,
get_dimensions(720, 1280, nullptr), true, input_story->is_animation_, 0, 0.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<int32>(std::ceil(input_story->duration_)), input_story->duration_,
get_dimensions(720, 1280, nullptr), true, input_story->is_animation_, 0,
input_story->main_frame_timestamp_, false);
return make_unique<StoryContentVideo>(file_id, FileId());
}

View File

@ -295,9 +295,12 @@ tl_object_ptr<telegram_api::InputMedia> VideosManager::get_input_media(
if (video->is_animation) {
attribute_flags |= telegram_api::documentAttributeVideo::NOSOUND_MASK;
}
if (video->start_ts > 0.0) {
attribute_flags |= telegram_api::documentAttributeVideo::VIDEO_START_TS_MASK;
}
attributes.push_back(make_tl_object<telegram_api::documentAttributeVideo>(
attribute_flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, video->precise_duration,
video->dimensions.width, video->dimensions.height, 0, 0.0));
video->dimensions.width, video->dimensions.height, 0, video->start_ts));
}
if (!video->file_name.empty()) {
attributes.push_back(make_tl_object<telegram_api::documentAttributeFilename>(video->file_name));

View File

@ -4647,8 +4647,8 @@ class CliClient final : public Actor {
get_args(args, chat_id, video, caption, rules, areas, active_period, duration, sticker_file_ids, protect_content);
send_request(td_api::make_object<td_api::sendStory>(
chat_id,
td_api::make_object<td_api::inputStoryContentVideo>(as_input_file(video),
to_integers<int32>(sticker_file_ids), duration, true),
td_api::make_object<td_api::inputStoryContentVideo>(
as_input_file(video), to_integers<int32>(sticker_file_ids), duration, 0.5, true),
areas, as_caption(caption), rules, active_period ? active_period : 86400, get_reposted_story_full_id(),
op == "ssvp", protect_content));
} else if (op == "esc") {
@ -4683,8 +4683,8 @@ class CliClient final : public Actor {
get_args(args, story_sender_chat_id, story_id, video, caption, duration, sticker_file_ids);
send_request(td_api::make_object<td_api::editStory>(
story_sender_chat_id, story_id,
td_api::make_object<td_api::inputStoryContentVideo>(as_input_file(video),
to_integers<int32>(sticker_file_ids), duration, false),
td_api::make_object<td_api::inputStoryContentVideo>(
as_input_file(video), to_integers<int32>(sticker_file_ids), duration, 0.0, false),
areas, as_caption(caption)));
} else if (op == "ssps") {
StoryId story_id;