From 67d255a2de7ca85b35a67bff25ef9b6770b453a0 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 6 Oct 2019 01:05:32 +0200 Subject: [PATCH] Add basic video messages Size is fixed for now, otherwise the Video output ends up somewhere... --- resources/qml/TimelineView.qml | 4 ++-- .../{AudioMessage.qml => PlayableMediaMessage.qml} | 12 ++++++++++++ resources/res.qrc | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) rename resources/qml/delegates/{AudioMessage.qml => PlayableMediaMessage.qml} (91%) diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index c25e6543..4d8c22b8 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -112,8 +112,8 @@ Rectangle { case MtxEvent.TextMessage: return "delegates/TextMessage.qml" case MtxEvent.ImageMessage: return "delegates/ImageMessage.qml" case MtxEvent.FileMessage: return "delegates/FileMessage.qml" - //case MtxEvent.VideoMessage: return "delegates/VideoMessage.qml" - case MtxEvent.AudioMessage: return "delegates/AudioMessage.qml" + case MtxEvent.VideoMessage: return "delegates/PlayableMediaMessage.qml" + case MtxEvent.AudioMessage: return "delegates/PlayableMediaMessage.qml" case MtxEvent.Redacted: return "delegates/Redacted.qml" default: return "delegates/placeholder.qml" } diff --git a/resources/qml/delegates/AudioMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml similarity index 91% rename from resources/qml/delegates/AudioMessage.qml rename to resources/qml/delegates/PlayableMediaMessage.qml index f4fa8f54..7498d5b2 100644 --- a/resources/qml/delegates/AudioMessage.qml +++ b/resources/qml/delegates/PlayableMediaMessage.qml @@ -3,6 +3,8 @@ import QtQuick.Layouts 1.6 import QtQuick.Controls 2.5 import QtMultimedia 5.6 +import com.github.nheko 1.0 + Rectangle { radius: 10 color: colors.dark @@ -14,6 +16,15 @@ Rectangle { width: parent.width - 24 anchors.centerIn: parent + VideoOutput { + visible: eventData.type == MtxEvent.VideoMessage + Layout.maximumHeight: 300 + Layout.minimumHeight: 300 + Layout.maximumWidth: 500 + fillMode: VideoOutput.PreserveAspectFit + source: media + } + RowLayout { Text { id: positionText @@ -91,6 +102,7 @@ Rectangle { id: media onError: console.log(errorString) onStatusChanged: if(status == MediaPlayer.Loaded) progress.updatePositionTexts() + autoPlay: true } Connections { diff --git a/resources/res.qrc b/resources/res.qrc index 1caf378e..16bab4e4 100644 --- a/resources/res.qrc +++ b/resources/res.qrc @@ -122,7 +122,7 @@ qml/delegates/TextMessage.qml qml/delegates/NoticeMessage.qml qml/delegates/ImageMessage.qml - qml/delegates/AudioMessage.qml + qml/delegates/PlayableMediaMessage.qml qml/delegates/FileMessage.qml qml/delegates/Redacted.qml qml/delegates/placeholder.qml