mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Fix playable media playback
This commit is contained in:
parent
686cade0ab
commit
1b216870eb
2 changed files with 23 additions and 24 deletions
|
@ -25,9 +25,9 @@ Item {
|
||||||
property double divisor: isReply ? 4 : 2
|
property double divisor: isReply ? 4 : 2
|
||||||
property int tempWidth: originalWidth < 1? 400: originalWidth
|
property int tempWidth: originalWidth < 1? 400: originalWidth
|
||||||
implicitWidth: type == MtxEvent.VideoMessage ? Math.round(tempWidth*Math.min((timelineView.height/divisor)/(tempWidth*proportionalHeight), 1)) : 500
|
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
|
height: (type == MtxEvent.VideoMessage ? width*proportionalHeight : 80) + fileInfoLabel.height
|
||||||
implicitHeight: height
|
//implicitHeight: height
|
||||||
|
|
||||||
property int metadataWidth
|
property int metadataWidth
|
||||||
property bool fitsMetadata: (parent.width - fileInfoLabel.width) > metadataWidth+4
|
property bool fitsMetadata: (parent.width - fileInfoLabel.width) > metadataWidth+4
|
||||||
|
@ -73,29 +73,28 @@ Item {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
MediaControls {
|
||||||
|
id: mediaControls
|
||||||
|
|
||||||
MediaControls {
|
anchors.left: videoContainer.left
|
||||||
id: mediaControls
|
anchors.right: videoContainer.right
|
||||||
|
anchors.bottom: videoContainer.bottom
|
||||||
anchors.left: content.left
|
playingVideo: type == MtxEvent.VideoMessage
|
||||||
anchors.right: content.right
|
positionValue: mxcmedia.position
|
||||||
anchors.bottom: fileInfoLabel.top
|
duration: mediaLoaded ? mxcmedia.duration : content.duration
|
||||||
playingVideo: type == MtxEvent.VideoMessage
|
mediaLoaded: mxcmedia.loaded
|
||||||
positionValue: mxcmedia.position
|
mediaState: mxcmedia.playbackState
|
||||||
duration: mediaLoaded ? mxcmedia.duration : content.duration
|
onPositionChanged: mxcmedia.position = position
|
||||||
mediaLoaded: mxcmedia.loaded
|
onPlayPauseActivated: mxcmedia.playbackState == MediaPlayer.PlayingState ? mxcmedia.pause() : mxcmedia.play()
|
||||||
mediaState: mxcmedia.state
|
onLoadActivated: mxcmedia.eventId = eventId
|
||||||
onPositionChanged: mxcmedia.position = position
|
}
|
||||||
onPlayPauseActivated: mxcmedia.state == MediaPlayer.PlayingState ? mxcmedia.pause() : mxcmedia.play()
|
|
||||||
onLoadActivated: mxcmedia.eventId = eventId
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// information about file name and file size
|
// information about file name and file size
|
||||||
Label {
|
Label {
|
||||||
id: fileInfoLabel
|
id: fileInfoLabel
|
||||||
|
|
||||||
anchors.bottom: content.bottom
|
anchors.top: videoContainer.bottom
|
||||||
text: body + " [" + filesize + "]"
|
text: body + " [" + filesize + "]"
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
|
|
||||||
import "../"
|
import "../"
|
||||||
import "../../"
|
import "../../"
|
||||||
import QtMultimedia 5.15
|
import QtMultimedia
|
||||||
import QtQuick 2.15
|
import QtQuick
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts
|
||||||
import im.nheko 1.0
|
import im.nheko
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: control
|
id: control
|
||||||
|
@ -130,7 +130,7 @@ Rectangle {
|
||||||
NhekoSlider {
|
NhekoSlider {
|
||||||
id: volumeSlider
|
id: volumeSlider
|
||||||
|
|
||||||
property real desiredVolume: QtMultimedia.convertVolume(volumeSlider.value, QtMultimedia.LogarithmicVolumeScale, QtMultimedia.LinearVolumeScale)
|
property real desiredVolume: volumeSlider.value
|
||||||
|
|
||||||
state: ""
|
state: ""
|
||||||
Layout.alignment: Qt.AlignLeft
|
Layout.alignment: Qt.AlignLeft
|
||||||
|
|
Loading…
Reference in a new issue