Allow to create RTMP video chats.

This commit is contained in:
levlam 2022-02-22 16:37:11 +03:00
parent 4e1f2cbf8b
commit 719bdb1e08
5 changed files with 15 additions and 8 deletions

View File

@ -5266,7 +5266,8 @@ setVideoChatDefaultParticipant chat_id:int53 default_participant_id:MessageSende
//@chat_id Chat identifier, in which the video chat will be created
//@title Group call title; if empty, chat title will be used
//@start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future
createVideoChat chat_id:int53 title:string start_date:int32 = GroupCallId;
//@is_rtmp_stream True, if the chat will be an RTMP stream instead of an ordinary video chat
createVideoChat chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId;
//@description Returns information about a group call @group_call_id Group call identifier
getGroupCall group_call_id:int32 = GroupCall;

View File

@ -159,7 +159,7 @@ class CreateGroupCallQuery final : public Td::ResultHandler {
explicit CreateGroupCallQuery(Promise<InputGroupCallId> &&promise) : promise_(std::move(promise)) {
}
void send(DialogId dialog_id, const string &title, int32 start_date) {
void send(DialogId dialog_id, const string &title, int32 start_date, bool is_rtmp_stream) {
dialog_id_ = dialog_id;
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
@ -172,6 +172,9 @@ class CreateGroupCallQuery final : public Td::ResultHandler {
if (start_date > 0) {
flags |= telegram_api::phone_createGroupCall::SCHEDULE_DATE_MASK;
}
if (is_rtmp_stream) {
flags |= telegram_api::phone_createGroupCall::RTMP_STREAM_MASK;
}
send_query(G()->net_query_creator().create(telegram_api::phone_createGroupCall(
flags, false, std::move(input_peer), Random::secure_int32(), title, start_date)));
}
@ -1243,7 +1246,7 @@ void GroupCallManager::set_group_call_default_join_as(DialogId dialog_id, Dialog
td_->messages_manager_->on_update_dialog_default_join_group_call_as_dialog_id(dialog_id, as_dialog_id, true);
}
void GroupCallManager::create_voice_chat(DialogId dialog_id, string title, int32 start_date,
void GroupCallManager::create_voice_chat(DialogId dialog_id, string title, int32 start_date, bool is_rtmp_stream,
Promise<GroupCallId> &&promise) {
if (!dialog_id.is_valid()) {
return promise.set_error(Status::Error(400, "Invalid chat identifier specified"));
@ -1268,7 +1271,8 @@ void GroupCallManager::create_voice_chat(DialogId dialog_id, string title, int32
std::move(promise));
}
});
td_->create_handler<CreateGroupCallQuery>(std::move(query_promise))->send(dialog_id, title, start_date);
td_->create_handler<CreateGroupCallQuery>(std::move(query_promise))
->send(dialog_id, title, start_date, is_rtmp_stream);
}
void GroupCallManager::on_voice_chat_created(DialogId dialog_id, InputGroupCallId input_group_call_id,

View File

@ -49,7 +49,8 @@ class GroupCallManager final : public Actor {
void set_group_call_default_join_as(DialogId dialog_id, DialogId as_dialog_id, Promise<Unit> &&promise);
void create_voice_chat(DialogId dialog_id, string title, int32 start_date, Promise<GroupCallId> &&promise);
void create_voice_chat(DialogId dialog_id, string title, int32 start_date, bool is_rtmp_stream,
Promise<GroupCallId> &&promise);
void get_group_call(GroupCallId group_call_id, Promise<td_api::object_ptr<td_api::groupCall>> &&promise);

View File

@ -5744,7 +5744,7 @@ void Td::on_request(uint64 id, td_api::createVideoChat &request) {
}
});
group_call_manager_->create_voice_chat(DialogId(request.chat_id_), std::move(request.title_), request.start_date_,
std::move(query_promise));
request.is_rtmp_stream_, std::move(query_promise));
}
void Td::on_request(uint64 id, const td_api::getGroupCall &request) {

View File

@ -3020,8 +3020,9 @@ class CliClient final : public Actor {
ChatId chat_id;
string title;
int32 start_date;
get_args(args, chat_id, title, start_date);
send_request(td_api::make_object<td_api::createVideoChat>(chat_id, title, start_date));
bool is_rtmp_stream;
get_args(args, chat_id, title, start_date, is_rtmp_stream);
send_request(td_api::make_object<td_api::createVideoChat>(chat_id, title, start_date, is_rtmp_stream));
} else if (op == "ggc") {
send_request(td_api::make_object<td_api::getGroupCall>(as_group_call_id(args)));
} else if (op == "ggcss") {