Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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



  • 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.



  • 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.



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



  • That works thanks.



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


Log in to reply