Files
qyouvideo/VideoPlayer.qml

110 lines
2.5 KiB
QML
Raw Normal View History

2025-10-18 21:40:02 +02:00
import QtQuick 6.8
import QtMultimedia 6.8
import QtQuick.Controls 6.8
import QtQuick.Layouts 6.8
import QYRComponents 1.0
Rectangle {
2025-10-19 02:58:12 +02:00
visible: Player.active
2025-10-18 21:40:02 +02:00
color: Colors.surface1
2025-10-19 02:58:12 +02:00
radius: 10
property bool unrolled: true
2025-10-18 21:40:02 +02:00
2025-10-18 23:00:53 +02:00
// width: childrenRect.width
2025-10-19 02:58:12 +02:00
height: unrolled ? 560 : 96
MouseArea {
anchors.fill: parent
height: 20
hoverEnabled: true
propagateComposedEvents: true
onClicked: unrolled = true;
onContainsMouseChanged: function() {
if (!containsMouse) {
unrolled = false;
}
}
}
2025-10-18 21:40:02 +02:00
ColumnLayout {
anchors.fill: parent
2025-10-19 02:58:12 +02:00
Item {
visible: unrolled
Layout.fillHeight: true
}
2025-10-18 21:40:02 +02:00
RowLayout {
Button {
2025-10-19 02:58:12 +02:00
text: Player.loading ? "Loading" : (Player.playing ? "Pause" : "Play")
enabled: !Player.loading
2025-10-18 21:40:02 +02:00
onClicked: function() {
if (Player.playing) {
Player.pause()
} else {
Player.play();
}
}
}
Button {
text: "Stop"
onClicked: Player.stop()
}
2025-10-19 02:58:12 +02:00
Label {
heading: "h4"
text: new Date(Player.position).toISOString().slice(14, 19)
}
2025-10-18 21:40:02 +02:00
Slider {
Layout.fillWidth: true
from: 0
2025-10-19 02:58:12 +02:00
to: Player.duration
value: Player.position
buffered: Player.buffered
onMoved: Player.position = value
}
Label {
heading: "h4"
text: new Date(Player.duration).toISOString().slice(14, 19)
}
Label {
text: Player.buffered
2025-10-18 21:40:02 +02:00
}
Slider {
from: 0
to: 1
value: Player.volume
onMoved: Player.volume = value
}
}
2025-10-19 02:58:12 +02:00
Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
clip: true
text: Player.title
heading: "h2"
font.bold: true
}
Label {
visible: unrolled
Layout.fillWidth: true
wrapMode: Text.WordWrap
clip: true
text: Player.description
heading: "h4"
font.bold: true
}
2025-10-18 21:40:02 +02:00
}
}