Qt World Summit: Register Today!

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 {
        property bool change_video: false
        width: 320
        height: 240
        FolderListModel {
               id: folderModel
               folder: "file:///Users/michaellevin/Dropbox/Movie/Xcanvas/XXX/animation/"
               nameFilters: ["*.mov"]
            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: {
                var index = Math.floor(Math.random()*(folderModel.count))
                vvv.source = folderModel.get(index, "fileURL")
        Timer {
                id: start; interval: 10; running: true; repeat: false;
                onTriggered: vvv.source = folderModel.get(2, "fileURL")

Log in to reply