From 7a602690bb77ac72cc0ea8ecec56654713b27e3c Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 28 Feb 2022 20:26:37 +0300 Subject: [PATCH] Show information about absent RTMP stream. --- Telegram/Resources/langs/lang.strings | 6 ++-- .../calls/group/calls_group_panel.cpp | 33 +++++++++++++++++++ .../calls/group/calls_group_panel.h | 2 ++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index b6d37467c..8b1a6d0b0 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2364,8 +2364,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_group_call_unpinned_camera" = "{user}'s video is unpinned."; "lng_group_call_unpinned_screen" = "{user}'s screencast is unpinned."; "lng_group_call_sure_screencast" = "{user} is screensharing. This action will make your screencast pinned for all participants."; -"lng_group_call_pinned_on_top" = "Live stream pinned on top."; -"lng_group_call_unpinned_on_top" = "Live stream unpinned from top."; +"lng_group_call_pinned_on_top" = "Live stream is pinned on top."; +"lng_group_call_unpinned_on_top" = "Live stream is unpinned from top."; "lng_group_call_recording_start_sure" = "Participants will see the chat is being recorded."; "lng_group_call_recording_stop_sure" = "Do you want to stop recording this chat?"; "lng_group_call_recording_start_field" = "Recording Title"; @@ -2383,6 +2383,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_group_call_title_changed_channel" = "Live stream title changed to {title}"; "lng_group_call_join_as_changed" = "Members of this voice chat will now see you as {name}"; "lng_group_call_join_as_changed_channel" = "Members of this live stream will now see you as {name}"; +"lng_group_call_no_stream_admin" = "Oops! Telegram doesn't see any stream coming from your streaming app. Please make sure you entered the right Server URL and Stream Key in your app.."; +"lng_group_call_no_stream" = "{group} is currently not broadcasting live stream data to Telegram."; "lng_menu_start_group_call" = "Start video chat"; "lng_menu_start_group_call_scheduled" = "Schedule video chat"; diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp index d3b6ac564..0cdea8bf6 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp @@ -795,6 +795,7 @@ void Panel::setupMembers() { _members->show(); + setupEmptyRtmp(); refreshControlsBackground(); raiseControls(); @@ -1596,6 +1597,38 @@ void Panel::updateButtonsStyles() { : st::groupCallHangup); } +void Panel::setupEmptyRtmp() { + _call->emptyRtmpValue( + ) | rpl::start_with_next([=](bool empty) { + if (!empty) { + _emptyRtmp.destroy(); + return; + } else if (_emptyRtmp) { + return; + } + auto text = _call->rtmpUrl().isEmpty() + ? tr::lng_group_call_no_stream( + lt_group, + rpl::single(_peer->name)) + : tr::lng_group_call_no_stream_admin(); + _emptyRtmp.create( + widget(), + std::move(text), + st::groupCallVideoLimitLabel); + widget()->sizeValue( + ) | rpl::start_with_next([=](QSize size) { + const auto width = std::min( + size.width() - st::groupCallWidth / 10, + st::groupCallWidth); + _emptyRtmp->resizeToWidth(width); + _emptyRtmp->move( + (size.width() - _emptyRtmp->width()) / 2, + (size.height() - _emptyRtmp->height()) / 3); + }, _emptyRtmp->lifetime()); + }, lifetime()); + +} + void Panel::refreshControlsBackground() { if (!_members) { return; diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.h b/Telegram/SourceFiles/calls/group/calls_group_panel.h index 3b1e022b0..cbbd2764c 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.h +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.h @@ -161,6 +161,7 @@ private: std::optional overrideWideMode = std::nullopt); void refreshTopButton(); void createPinOnTop(); + void setupEmptyRtmp(); void toggleWideControls(bool shown); void updateWideControlsVisibility(); [[nodiscard]] bool videoButtonInNarrowMode() const; @@ -225,6 +226,7 @@ private: object_ptr _countdown = { nullptr }; std::shared_ptr _countdownData; object_ptr _startsWhen = { nullptr }; + object_ptr _emptyRtmp = { nullptr }; ChooseJoinAsProcess _joinAsProcess; std::optional _lastSmallGeometry; std::optional _lastLargeGeometry;