summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-06-04 03:22:57 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-06-08 22:32:13 +0200
commit1b216870ebb7d424f80d7ff2ff17c3b43a7f4521 (patch)
treebfda8048b903dde63eab017b8fc5de71da843235 /resources/qml
parentFix some undefined variables in the UploadBox (diff)
downloadnheko-1b216870ebb7d424f80d7ff2ff17c3b43a7f4521.tar.xz
Fix playable media playback
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/delegates/PlayableMediaMessage.qml37
-rw-r--r--resources/qml/ui/media/MediaControls.qml12
2 files changed, 24 insertions, 25 deletions
diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml
index 60a61372..fb7bf0cc 100644
--- a/resources/qml/delegates/PlayableMediaMessage.qml
+++ b/resources/qml/delegates/PlayableMediaMessage.qml
@@ -25,9 +25,9 @@ Item {
     property double divisor: isReply ? 4 : 2
     property int tempWidth: originalWidth < 1? 400: originalWidth
     implicitWidth: type == MtxEvent.VideoMessage ? Math.round(tempWidth*Math.min((timelineView.height/divisor)/(tempWidth*proportionalHeight), 1)) : 500
-    width: Math.min(parent.width, implicitWidth)
+    width: Math.min(parent?.width ?? implicitWidth, implicitWidth)
     height: (type == MtxEvent.VideoMessage ? width*proportionalHeight : 80) + fileInfoLabel.height
-    implicitHeight: height
+    //implicitHeight: height
 
     property int metadataWidth
     property bool fitsMetadata: (parent.width - fileInfoLabel.width) > metadataWidth+4
@@ -73,29 +73,28 @@ Item {
 
         }
 
-    }
-
-    MediaControls {
-        id: mediaControls
-
-        anchors.left: content.left
-        anchors.right: content.right
-        anchors.bottom: fileInfoLabel.top
-        playingVideo: type == MtxEvent.VideoMessage
-        positionValue: mxcmedia.position
-        duration: mediaLoaded ? mxcmedia.duration : content.duration
-        mediaLoaded: mxcmedia.loaded
-        mediaState: mxcmedia.state
-        onPositionChanged: mxcmedia.position = position
-        onPlayPauseActivated: mxcmedia.state == MediaPlayer.PlayingState ? mxcmedia.pause() : mxcmedia.play()
-        onLoadActivated: mxcmedia.eventId = eventId
+        MediaControls {
+            id: mediaControls
+
+            anchors.left: videoContainer.left
+            anchors.right: videoContainer.right
+            anchors.bottom: videoContainer.bottom
+            playingVideo: type == MtxEvent.VideoMessage
+            positionValue: mxcmedia.position
+            duration: mediaLoaded ? mxcmedia.duration : content.duration
+            mediaLoaded: mxcmedia.loaded
+            mediaState: mxcmedia.playbackState
+            onPositionChanged: mxcmedia.position = position
+            onPlayPauseActivated: mxcmedia.playbackState == MediaPlayer.PlayingState ? mxcmedia.pause() : mxcmedia.play()
+            onLoadActivated: mxcmedia.eventId = eventId
+        }
     }
 
     // information about file name and file size
     Label {
         id: fileInfoLabel
 
-        anchors.bottom: content.bottom
+        anchors.top: videoContainer.bottom
         text: body + " [" + filesize + "]"
         textFormat: Text.RichText
         elide: Text.ElideRight
diff --git a/resources/qml/ui/media/MediaControls.qml b/resources/qml/ui/media/MediaControls.qml
index a48f15ea..bd5f6ddc 100644
--- a/resources/qml/ui/media/MediaControls.qml
+++ b/resources/qml/ui/media/MediaControls.qml
@@ -4,11 +4,11 @@
 
 import "../"
 import "../../"
-import QtMultimedia 5.15
-import QtQuick 2.15
-import QtQuick.Controls 2.15
-import QtQuick.Layouts 1.15
-import im.nheko 1.0
+import QtMultimedia
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import im.nheko
 
 Rectangle {
     id: control
@@ -130,7 +130,7 @@ Rectangle {
             NhekoSlider {
                 id: volumeSlider
 
-                property real desiredVolume: QtMultimedia.convertVolume(volumeSlider.value, QtMultimedia.LogarithmicVolumeScale, QtMultimedia.LinearVolumeScale)
+                property real desiredVolume: volumeSlider.value
 
                 state: ""
                 Layout.alignment: Qt.AlignLeft