Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qml VideoOutput doesn't work after setting source to null once
Qt 6.11 is out! See what's new in the release blog

Qml VideoOutput doesn't work after setting source to null once

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 3 Posters 2.1k 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.
  • T Offline
    T Offline
    theonlylawislove
    wrote on last edited by
    #1
    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtMultimedia 5.8
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
    
        property bool flip: true
    
        Timer {
            interval: 5000
            running: true
            repeat: true
            onTriggered: {
                flip = !flip
                if(flip) {
                    videoOutput.source = null
                } else {
                    videoOutput.source = player
                }
            }
        }
    
        VideoOutput {
            id: videoOutput
            anchors.fill: parent
            source: player
        }
    
        MediaPlayer {
            id: player
            source: "file://video.mp4"
            autoPlay: true
            loops:  MediaPlayer.Infinite
        }
    }
    

    After a few a trigger of Timer that sets videoOutput.source to null, it will never work again. The VideoOutput will just have a stale painting of a previously decoded frame, and will never change.

    Cross posted here.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lplessard
      wrote on last edited by
      #2

      Any update on this?

      I think I'm running into the same issue. This problem seems to be present on Linux, but not on Windows.

      1 Reply Last reply
      0
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by
        #3

        Why not change the source on the MediaPlayer rather than the VideoOuput?

        C++ is a perfectly valid school of magic.

        1 Reply Last reply
        2
        • L Offline
          L Offline
          lplessard
          wrote on last edited by
          #4

          That works thanks.

          fcarneyF 1 Reply Last reply
          1
          • L lplessard

            That works thanks.

            fcarneyF Offline
            fcarneyF Offline
            fcarney
            wrote on last edited by
            #5

            @lplessard I feel like I have closure now. ;-)

            C++ is a perfectly valid school of magic.

            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