mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 22:46:10 +00:00
Pause all media if a call is created.
Pause video, voice messages, songs and stop video messages.
This commit is contained in:
@@ -39,6 +39,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
#include "auth_session.h"
|
||||
#include "messenger.h"
|
||||
#include "storage/file_download.h"
|
||||
#include "calls/calls_instance.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -90,19 +91,24 @@ MediaView::MediaView(QWidget*) : TWidget(nullptr)
|
||||
connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(onScreenResized(int)));
|
||||
|
||||
// While we have one mediaview for all authsessions we have to do this.
|
||||
auto subscribeToDownloadFinished = [this] {
|
||||
auto handleAuthSessionChange = [this] {
|
||||
if (AuthSession::Exists()) {
|
||||
subscribe(AuthSession::CurrentDownloaderTaskFinished(), [this] {
|
||||
if (!isHidden()) {
|
||||
updateControls();
|
||||
}
|
||||
});
|
||||
subscribe(AuthSession::Current().calls().currentCallChanged(), [this](Calls::Call *call) {
|
||||
if (call && _clipController && !_videoPaused) {
|
||||
onVideoPauseResume();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
subscribe(Messenger::Instance().authSessionChanged(), [subscribeToDownloadFinished] {
|
||||
subscribeToDownloadFinished();
|
||||
subscribe(Messenger::Instance().authSessionChanged(), [handleAuthSessionChange] {
|
||||
handleAuthSessionChange();
|
||||
});
|
||||
subscribeToDownloadFinished();
|
||||
handleAuthSessionChange();
|
||||
|
||||
auto observeEvents = Notify::PeerUpdate::Flag::SharedMediaChanged;
|
||||
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) {
|
||||
|
Reference in New Issue
Block a user