1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-07 09:47:07 +02:00
ScreenPlay/ScreenPlayWindow/ScreenVideo.qml

78 lines
1.6 KiB
QML
Raw Normal View History

2018-02-14 10:21:15 +01:00
import QtQuick 2.9
import QtAV 1.7
Rectangle {
id: screenVideoPlayer
2018-02-18 16:46:47 +01:00
color: "black"
2018-02-14 10:21:15 +01:00
anchors.fill: parent
property string videoPath
2018-02-18 16:46:47 +01:00
onVideoPathChanged: {
player.source = Qt.resolvedUrl("file:///" + videoPath)
player.play()
2018-02-14 10:21:15 +01:00
}
2018-02-18 16:46:47 +01:00
property bool isPlaying: true
2018-02-14 10:21:15 +01:00
VideoOutput2 {
id: videoOut
anchors.fill: parent
source: player
opengl: true
fillMode: VideoOutput.Stretch
}
MediaPlayer {
id: player
videoCodecPriority: ["CUDA", "VAAPI", "D3D11", "DXVA", "FFmpeg"]
loops: MediaPlayer.Infinite
volume: 0
2018-02-18 16:46:47 +01:00
onStatusChanged: {
2018-02-18 17:02:03 +01:00
if (player.status === MediaPlayer.Loaded) {
state = "playing"
2018-02-18 16:46:47 +01:00
mainwindow.init()
}
}
2018-02-14 10:21:15 +01:00
}
states: [
State {
name: "playing"
PropertyChanges {
2018-02-18 17:02:03 +01:00
target: player
volume: 1
2018-02-14 10:21:15 +01:00
}
2018-02-18 17:02:03 +01:00
},
State {
name: "destroy"
2018-02-14 10:21:15 +01:00
PropertyChanges {
target: player
2018-02-18 17:02:03 +01:00
volume: 0
2018-02-14 10:21:15 +01:00
}
}
]
transitions: [
Transition {
2018-02-18 17:02:03 +01:00
from: "*"
2018-02-14 10:21:15 +01:00
to: "playing"
reversible: true
2018-02-18 17:02:03 +01:00
NumberAnimation {
target: player
property: "volume"
duration: 1000
2018-02-14 10:21:15 +01:00
}
2018-02-18 17:02:03 +01:00
},
Transition {
from: "playing"
to: "destroy"
reversible: true
2018-02-14 10:21:15 +01:00
NumberAnimation {
target: player
property: "volume"
2018-02-18 17:02:03 +01:00
duration: 450
2018-02-14 10:21:15 +01:00
}
}
]
}