harbour-allradio/qml/items/VideoPlayer.qml
2025-05-28 20:47:14 +02:00

76 lines
2.3 KiB
QML

import QtQuick 2.0
import QtMultimedia 5.6
import Sailfish.Silica 1.0
import QtGraphicalEffects 1.0
Rectangle {
id: videoRect
//property bool keepScreenOn: Qt.application.active && visible ? true : false
property bool stateVisible: radioPlayer.radioVideo && radioPlayer.isPlaying
property alias videoSource: output.source
//property alias source: output.source
opacity: 0
color: "black"
//JupiiItem {id: jupii}
onOpacityChanged: {
opacity === 0 ? visible = false : visible = true
}
states: [
State { when: videoRect.stateVisible;
PropertyChanges { target: videoRect; opacity: 1.0 }},
State { when: !videoRect.stateVisible;
PropertyChanges { target: videoRect; opacity: 0.0 }}
]
transitions: [ Transition { NumberAnimation { property: "opacity"; duration: 500}} ]
/* ScreenBlank {
id: screenBlank
enabled: keepScreenOn
} */
MouseArea {
anchors.fill: parent
onClicked: videoOverlay.stateVisible = !videoOverlay.stateVisible
}
VideoOutput {
id: output
anchors.fill: parent
source: null
fillMode: VideoOutput.PreserveAspectFit
}
/* Timer {
interval: 5000; running: videoOverlay.visible ; repeat: false
onTriggered: videoOverlay.stateVisible = false
} */
Item {
id: videoOverlay
anchors.fill: parent
visible: false
property bool stateVisible: true
opacity: 1
onOpacityChanged: {
opacity === 0 ? visible = false : visible = true
}
states: [
State { when: videoOverlay.stateVisible;
PropertyChanges { target: videoOverlay; opacity: 1.0 }},
State { when: !videoOverlay.stateVisible;
PropertyChanges { target: videoOverlay; opacity: 0.0 }}
]
transitions: [ Transition { NumberAnimation { property: "opacity"; duration: 250}} ]
}
// Component.onCompleted: {playerPanel.open = false;radioPlayer.videoPlayerPageOpen=true;}
// Component.onDestruction: radioPlayer.videoPlayerPageOpen=false //Component.onDestruction: {if (radioPlayer.radioPlaying) playerPanel.open = true;radioPlayer.radioPlayerPageOpen = false}
}