From 787febdca2a67835e4bd2a78354266a7c30afa56 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Mon, 13 Feb 2023 23:51:31 -0500 Subject: [PATCH 1/2] Pause video when switching rooms Fixes #809 --- src/ui/MxcMediaProxy.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ui/MxcMediaProxy.cpp b/src/ui/MxcMediaProxy.cpp index 46d7430f..da5a2231 100644 --- a/src/ui/MxcMediaProxy.cpp +++ b/src/ui/MxcMediaProxy.cpp @@ -21,10 +21,12 @@ #include #endif +#include "ChatPage.h" #include "EventAccessors.h" #include "Logging.h" #include "MatrixClient.h" #include "timeline/TimelineModel.h" +#include "timeline/TimelineViewManager.h" MxcMediaProxy::MxcMediaProxy(QObject *parent) : QMediaPlayer(parent) @@ -47,6 +49,11 @@ MxcMediaProxy::MxcMediaProxy(QObject *parent) if (t == QMediaMetaData::Orientation) emit orientationChanged(); }); + + connect(ChatPage::instance()->timelineManager()->rooms(), + &RoomlistModel::currentRoomChanged, + this, + &MxcMediaProxy::pause); } void MxcMediaProxy::setVideoSurface(QAbstractVideoSurface *surface) From 905b127a739a7c8facf6cfa8883f58492a53f341 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Mon, 13 Feb 2023 23:52:40 -0500 Subject: [PATCH 2/2] Add a generic video icon when there is no thumbnail --- resources/qml/delegates/PlayableMediaMessage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml index c4c143cc..8b347b58 100644 --- a/resources/qml/delegates/PlayableMediaMessage.qml +++ b/resources/qml/delegates/PlayableMediaMessage.qml @@ -59,7 +59,7 @@ Item { Image { anchors.fill: parent - source: thumbnailUrl ? thumbnailUrl.replace("mxc://", "image://MxcImage/") + "?scale" : "" + source: thumbnailUrl ? thumbnailUrl.replace("mxc://", "image://MxcImage/") + "?scale" : "image://colorimage/:/icons/icons/ui/video-file.svg?" + Nheko.colors.windowText asynchronous: true fillMode: Image.PreserveAspectFit