mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Fix an issue with autoplay with Qt 5.12 because of policy changes in Chrome autoplay
This commit is contained in:
parent
dbc23984b9
commit
c22dcbd982
@ -1,5 +1,5 @@
|
||||
import QtQuick 2.9
|
||||
import QtWebEngine 1.7
|
||||
import QtWebEngine 1.8
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
@ -62,6 +62,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
||||
if (mainwindow.type === "qmlScene") {
|
||||
loader.setSource(Qt.resolvedUrl(
|
||||
"file:///" + mainwindow.fullContentPath))
|
||||
@ -79,13 +80,13 @@ Rectangle {
|
||||
mainwindow.init()
|
||||
timer.start()
|
||||
}
|
||||
mainwindow.init()
|
||||
timer.start()
|
||||
}
|
||||
|
||||
WebEngineView {
|
||||
id: webView
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
|
||||
onLoadProgressChanged: {
|
||||
if (loadProgress === 100) {
|
||||
runJavaScript(("
|
||||
@ -93,14 +94,30 @@ 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()
|
||||
videoPlayer.volume = " + mainwindow.volume + ";" +
|
||||
" videoPlayer.play();"), function (result) {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
onJavaScriptConsoleMessage: print(message)
|
||||
onJavaScriptConsoleMessage: {
|
||||
print(message)
|
||||
// runJavaScript("
|
||||
// var videoPlayer = document.getElementById('errorMsg');
|
||||
// var text = document.createTextNode("+message+");
|
||||
|
||||
// videoPlayer.appendChild(text);
|
||||
|
||||
//");
|
||||
|
||||
}
|
||||
|
||||
settings.allowRunningInsecureContent: true
|
||||
settings.accelerated2dCanvasEnabled: true
|
||||
settings.javascriptCanOpenWindows: false
|
||||
settings.printElementBackgrounds: false
|
||||
settings.showScrollBars: false
|
||||
settings.playbackRequiresUserGesture: false
|
||||
}
|
||||
|
||||
Loader {
|
||||
@ -133,4 +150,5 @@ videoPlayer.volume = " + mainwindow.volume + ";"), function (result) {
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user