Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. changing source of Video item causes hang
Qt 6.12 LTS is out! See what's new in the release blog

changing source of Video item causes hang

Scheduled Pinned Locked Moved QML and Qt Quick
qmlvideo
1 Posts 1 Posters 783 Views
  • 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.
  • michael levinM Offline
    michael levinM Offline
    michael levin
    wrote on last edited by
    #1

    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")
        }
    }
    
    
    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
    • Unsolved