1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-23 03:02:30 +01:00

Add playbackrate, message received and loops

This commit is contained in:
kelteseth 2018-09-07 21:12:17 +02:00
parent 3fc75239ef
commit c4c24a1ae8

View File

@ -1,23 +1,28 @@
import QtQuick 2.9
import QtWebEngine 1.6
import QtWebEngine 1.7
Rectangle {
id: root
color: "transparent"
anchors.fill: parent
property string tmpVideoPath
property var jsonProjectFile
Connections {
target: mainwindow
onFillModeChanged: {
//TODO
}
onMessageReceived: {
var obj2 = 'import QtQuick 2.9; Item {Component.onCompleted: loader.item.'
+ key + ' = ' + value + '; }'
var newObject = Qt.createQmlObject(obj2.toString(), root, "err")
newObject.destroy(10000)
}
onLoopsChanged: {
}
onTypeChanged: {
print(mainwindow.type)
if (webView.loadProgress === 100) {
webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.loop = " + loops + ";")
}
}
onVolumeChanged: {
@ -26,6 +31,14 @@ Rectangle {
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + volume + ";")
}
}
onPlaybackRateChanged: {
if (webView.loadProgress === 100) {
webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.playbackRate = " + playbackRate + ";")
}
}
onIsPlayingChanged: {
if (webView.loadProgress === 100) {
if (isPlaying === "false") {
@ -43,13 +56,13 @@ Rectangle {
if (mainwindow.type === "qmlScene") {
loader.setSource(Qt.resolvedUrl(
"file:///" + mainwindow.fullContentPath))
print("LOADING QMLSCENE" + loader.source)
mainwindow.init()
timer.start()
} else if (mainwindow.type === "video") {
webView.visible = true
webView.url = Qt.resolvedUrl("file:///" + mainwindow.getApplicationPath(
) + "/index.html")
webView.url = Qt.resolvedUrl(
"file:///" + mainwindow.getApplicationPath(
) + "/index.html")
}
}