Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Embed Youtube Autoplay
Forum Updated to NodeBB v4.3 + New Features

Embed Youtube Autoplay

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 2 Posters 532 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Shrinidhi UpadhyayaS Offline
    Shrinidhi UpadhyayaS Offline
    Shrinidhi Upadhyaya
    wrote on last edited by Shrinidhi Upadhyaya
    #1

    Hi Everyone,

    I was trying to embed a youtube video with autoplay, the video gets loaded, but does not autoplay.

    Could someone help me out?

    Here is my code:-

    main.qml

     WebView {
                id: webOutput
                anchors.fill: parent
    
                Component.onCompleted: {
                    var request = new XMLHttpRequest()
                    request.open('GET',  "qrc:/player1.html")
    
                    request.onreadystatechange = function(event) {
                        if (request.readyState === XMLHttpRequest.DONE) {
                            var response = request.responseText
                            console.log("##")
                            console.log(response)
                            webOutput.loadHtml(response)
                        }
                    }
                    request.send()
                }
            }
    

    player1.html

    <iframe width="560" height="315"
    src="https://www.youtube.com/embed/7ZW8hthGL0U?autoplay=1">
    </iframe>
    

    Shrinidhi Upadhyaya.
    Upvote the answer(s) that helped you to solve the issue.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What if you load that page direct in your view ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Shrinidhi UpadhyayaS Offline
        Shrinidhi UpadhyayaS Offline
        Shrinidhi Upadhyaya
        wrote on last edited by
        #3

        Hi @SGaist , if load it directly the video plays on mute.

        Shrinidhi Upadhyaya.
        Upvote the answer(s) that helped you to solve the issue.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved