Hi,
I am getting error when usingĀ runPlayerScript(“setVolume”, 20). The code below and the screen shoot on this link.
import Felgo 3.0
import QtQuick 2.0
App {
NavigationStack {
Page {
title: "YouTube Player"
YouTubeWebPlayer {
id: player
videoId: "KQgqTYCfJjM"
autoplay: true
// hide player iframe and display message on error
playerErrorScript: "
player.getIframe().style.display='none';
document.getElementById('videoIdError').style.display='block';
"
// show player iframe and hide message when new video has loaded
playerStateChangeScript: "if(event.data == YT.PlayerState.PLAYING) {
document.getElementById('videoIdError').style.display='none';
player.getIframe().style.display='block';
}"
// add custom HTML for showing the error
customHTML: '<style>
.videoError {
background-color: black;
color: white;
width: 100%;
height: 100%;
position: absolute;
display: none;
}
</style >
<div id="videoIdError" class="videoError">
This video is not available.
</div>'
}
Rectangle {
anchors.top: player.bottom
width: parent.width
height: controls.height
color: Theme.backgroundColor
Row {
id: controls
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: player.bottom
AppButton {
text: "Change Video"
// anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
if(player.videoId == "KQgqTYCfJjM")
player.videoId = "*invalid!"
else
player.videoId = "KQgqTYCfJjM"
}
// controls
}
AppButton {
text: "Play"
onClicked: {
player.play()
}
}
AppButton {
text: "Pause"
onClicked: player.pause()
}
AppButton {
text: "Run Script"
onClicked: {
player.runPlayerScript("setVolume", 20)
// player.seekTo(40)
}
}
AppButton {
text: "Seek"
onClicked: {
// player.seekTo(40)
}
}
}
}
}
}
}