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)
|
|
|
|
print("######### " + player.source)
|
|
|
|
state = "playing"
|
|
|
|
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
|
|
|
|
|
|
|
|
2018-02-18 16:46:47 +01:00
|
|
|
// onIsPlayingChanged: {
|
|
|
|
// if(isPlaying){
|
|
|
|
// player.play()
|
|
|
|
// state = "playing"
|
|
|
|
// } else {
|
|
|
|
// player.pause()
|
|
|
|
// state = ""
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// Connections{
|
|
|
|
// target: wallpaper
|
|
|
|
// onPrepareDestroy:{
|
|
|
|
// player.stop();
|
|
|
|
// wallpaper.destroyWindow()
|
|
|
|
// }
|
|
|
|
// onVolumeChanged:{
|
|
|
|
// player.volume = wallpaper.volume
|
|
|
|
// }
|
|
|
|
// onIsPlayingChanged:{
|
|
|
|
// if(wallpaper.isPlaying){
|
|
|
|
// player.play()
|
|
|
|
// } else {
|
|
|
|
// player.pause()
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// onDecoderChanged:{
|
|
|
|
// player.videoCodecPriority = [decoder]
|
|
|
|
// }
|
|
|
|
// onFillModeChanged:{
|
|
|
|
// if(fillMode === "Stretch"){
|
|
|
|
// videoOut.fillMode = VideoOutput2.Stretch
|
|
|
|
// } else if(fillMode === "PreserveAspectFit"){
|
|
|
|
// videoOut.fillMode = VideoOutput2.PreserveAspectFit
|
|
|
|
// }else if(fillMode === "PreserveAspectCrop"){
|
|
|
|
// videoOut.fillMode = VideoOutput2.PreserveAspectCrop
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
2018-02-14 10:21:15 +01:00
|
|
|
|
|
|
|
VideoOutput2 {
|
|
|
|
id: videoOut
|
|
|
|
anchors.fill: parent
|
|
|
|
source: player
|
|
|
|
opacity: 0
|
|
|
|
opengl: true
|
|
|
|
fillMode: VideoOutput.Stretch
|
|
|
|
}
|
|
|
|
|
|
|
|
MediaPlayer {
|
|
|
|
id: player
|
2018-02-18 16:46:47 +01:00
|
|
|
|
2018-02-14 10:21:15 +01:00
|
|
|
videoCodecPriority: ["CUDA", "VAAPI", "D3D11", "DXVA", "FFmpeg"]
|
|
|
|
loops: MediaPlayer.Infinite
|
|
|
|
volume: 0
|
2018-02-18 16:46:47 +01:00
|
|
|
onStatusChanged: {
|
|
|
|
print("STATUS: " + player.status)
|
|
|
|
if(player.status === MediaPlayer.Loaded){
|
|
|
|
print("init")
|
|
|
|
mainwindow.init()
|
|
|
|
}
|
|
|
|
}
|
2018-02-14 10:21:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "playing"
|
|
|
|
PropertyChanges {
|
|
|
|
target: videoOut
|
|
|
|
opacity: 1
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: player
|
|
|
|
volume: 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
transitions: [
|
|
|
|
Transition {
|
|
|
|
from: ""
|
|
|
|
to: "playing"
|
|
|
|
reversible: true
|
|
|
|
|
|
|
|
OpacityAnimator {
|
|
|
|
target: videoOut
|
|
|
|
duration: 300
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
}
|
|
|
|
NumberAnimation {
|
|
|
|
target: player
|
|
|
|
property: "volume"
|
|
|
|
duration: 300
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|