Page MenuHomePhorge

Video.qml
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

Video.qml

/*
* Copyright (C) 2020-2021 Tusooa Zhu <tusooa@kazv.moe>
*
* This file is part of kazv.
*
* kazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* kazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with kazv. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.2
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtMultimedia 5.15
import org.kde.kirigami 2.13 as Kirigami
import '..' as Kazv
Simple {
id: upper
property var gender: 'neutral'
property var body: event.content.body
property var mxcUri: event.content.url
property var videoUri: matrixSdk.mxcUriToHttp(mxcUri)
Kazv.Bubble {
ColumnLayout {
id: layout
Label {
Layout.fillWidth: true
wrapMode: Text.Wrap
text: l10n.get('event-message-video-sent', { gender, body })
}
Video {
id: video
source: videoUri
autoLoad: false
autoPlay: false
Layout.minimumHeight: Kirigami.Units.gridUnit * 10
Layout.minimumWidth: Kirigami.Units.gridUnit * 10
Layout.maximumWidth: layout.width
property var videoWidth: metaData.resolution ? metaData.resolution.width : 0
property var videoHeight: metaData.resolution ? metaData.resolution.height : 0
Layout.preferredWidth: videoWidth
Layout.preferredHeight: videoHeight / videoWidth * width
MouseArea {
anchors.fill: parent
onClicked: {
video.playOrPause();
}
}
Rectangle {
anchors.fill: parent
color: Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.15)
visible: video.playbackState != Qt.PlayingState
}
function playOrPause() {
if (video.playbackState == Qt.PlayingState) {
video.pause();
} else {
video.play();
}
}
}
}
}
}

File Metadata

Mime Type
text/plain
Expires
Tue, Jun 24, 9:30 PM (18 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
235024
Default Alt Text
Video.qml (2 KB)

Event Timeline