Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Bug : YouTubeWebPlayer – runPlayerScript TypeError: Type error

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22235

    Barazi Ala

    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)
                  }
              }
            }
          }
        }
      }
    }
    
    

     

     

    #22253

    Barazi Ala

    Any idea why this is happening ?

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded