mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
62 lines
1.5 KiB
QML
62 lines
1.5 KiB
QML
import QtQuick
|
|
import QtMultimedia
|
|
import ScreenPlayWallpaper 1.0
|
|
|
|
Item {
|
|
id: root
|
|
anchors.fill: parent
|
|
property bool loops: Wallpaper.loops
|
|
property bool isPlaying: Wallpaper.isPlaying
|
|
onIsPlayingChanged: isPlaying ? mediaPlayer.play() : mediaPlayer.pause()
|
|
property bool isWindows: Qt.platform.os === "windows"
|
|
signal requestFadeIn
|
|
|
|
MediaPlayer {
|
|
id: mediaPlayer
|
|
|
|
|
|
source: Wallpaper.projectSourceFileAbsolute
|
|
Component.onCompleted: {
|
|
mediaPlayer.play()
|
|
root.requestFadeIn()
|
|
}
|
|
loops: root.loops ? MediaPlayer.Infinite : 1
|
|
videoOutput: vo
|
|
audioOutput: ao
|
|
}
|
|
VideoOutput {
|
|
id: vo
|
|
anchors.fill: parent
|
|
|
|
}
|
|
|
|
AudioOutput {
|
|
id: ao
|
|
volume: Wallpaper.volume
|
|
muted: Wallpaper.muted
|
|
}
|
|
|
|
Connections {
|
|
function onFillModeChanged(fillMode) {
|
|
if(fillMode === "stretch"){
|
|
vo.fillMode = VideoOutput.Stretch
|
|
return
|
|
}
|
|
if(fillMode === "fill"){
|
|
vo.fillMode = VideoOutput.PreserveAspectFit
|
|
return
|
|
}
|
|
if(fillMode === "contain" || fillMode === "cover" || fillMode === "scale-down"){
|
|
vo.fillMode = VideoOutput.PreserveAspectCrop
|
|
}
|
|
}
|
|
|
|
function onCurrentTimeChanged(currentTime) {
|
|
mediaPlayer.position = currentTime * mediaPlayer.duration
|
|
}
|
|
|
|
|
|
target: Wallpaper
|
|
}
|
|
}
|