changing source of Video item causes hang



  • I have a trouble in changing Video item sources. In a code below I pick randomly a mov file from the folder on a mouse click. After 2 - 7 (max) times it always hangs (on changing). All movs are rather small (700 kb - 7 mb). Any ideas how to fix it?

    import QtQuick 2.4
    import QtMultimedia 5.4
    import Qt.labs.folderlistmodel 2.1
    
    
    Item {
        id:container
        property bool change_video: false
        width: 320
        height: 240
    
        FolderListModel {
               id: folderModel
               folder: "file:///Users/michaellevin/Dropbox/Movie/Xcanvas/XXX/animation/"
               nameFilters: ["*.mov"]
           }
    
        Video
        {
            id: vvv
            width: container.width
            height: container.height
            //autoLoad: true
            autoPlay: true
            anchors.fill: parent
            anchors.margins: 0
            onStopped: play()
        }
    
        MouseArea {
            id: xxx
            anchors.fill: parent
            onClicked: {
                print(123)
                var index = Math.floor(Math.random()*(folderModel.count))
                print(index)
                //vvv.stop()
                vvv.source = folderModel.get(index, "fileURL")
                //vvv.play()
            }
        }
    
        Timer {
                id: start; interval: 10; running: true; repeat: false;
                onTriggered: vvv.source = folderModel.get(2, "fileURL")
        }
    }
    
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.