1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 11:32:42 +01:00
ScreenPlay/ScreenPlayWindow/main.qml

94 lines
2.4 KiB
QML
Raw Normal View History

import QtQuick 2.9
import QtWebEngine 1.6
Rectangle {
2018-03-12 15:23:03 +01:00
id: root
color: "transparent"
anchors.fill: parent
2018-02-18 16:46:47 +01:00
property string tmpVideoPath
2018-02-23 11:56:36 +01:00
property var jsonProjectFile
2018-02-14 10:21:15 +01:00
Connections {
target: mainwindow
2018-03-12 15:23:03 +01:00
2018-02-18 16:46:47 +01:00
onPlayVideo: {
2018-02-23 11:56:36 +01:00
}
onPlayQmlScene: {
}
onFillModeChanged: {
}
onLoopsChanged: {
}
onVolumeChanged: {
2018-09-06 13:57:36 +02:00
if (webView.loadProgress === 100) {
webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + volume + ";")
}
}
onIsPlayingChanged: {
if (webView.loadProgress === 100) {
if (isPlaying === "false") {
webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.play();")
} else {
webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.pause();")
}
}
}
}
2018-02-23 11:56:36 +01:00
WebEngineView {
id: webView
2018-02-23 11:56:36 +01:00
anchors.fill: parent
2018-09-06 13:57:36 +02:00
url: Qt.resolvedUrl("file:///" + mainwindow.getApplicationPath(
) + "/index.html")
onLoadProgressChanged: {
if (loadProgress === 100) {
2018-09-06 13:57:36 +02:00
runJavaScript(("
var videoPlayer = document.getElementById('videoPlayer');
var videoSource = document.getElementById('videoSource');
videoSource.src = \"file:///" + mainwindow.fullContentPath + "\";
videoPlayer.load();
videoPlayer.volume = " + mainwindow.volume + ";"),
function (result) {
mainwindow.init()
timer.start()
})
}
}
2018-08-25 00:43:23 +02:00
onJavaScriptConsoleMessage: print(message)
settings.allowRunningInsecureContent: true
2018-03-12 15:23:03 +01:00
}
2018-09-06 13:57:36 +02:00
Timer {
2018-09-06 13:57:36 +02:00
id: timer
2018-08-25 00:43:23 +02:00
interval: 200
onTriggered: {
2018-08-25 00:43:23 +02:00
curtain.opacity = 0
anim.start()
print("start")
}
}
Rectangle {
2018-09-06 13:57:36 +02:00
id: curtain
2018-08-25 00:43:23 +02:00
anchors.fill: parent
color: "black"
PropertyAnimation {
2018-09-06 13:57:36 +02:00
id: anim
2018-08-25 00:43:23 +02:00
property: "opacity"
target: curtain
from: "1"
to: "0"
duration: 300
2018-03-12 15:23:03 +01:00
}
2018-02-23 11:56:36 +01:00
}
}