Playing video and showing images with xmllistmodel and listview



  • It's possible to show both in one listview? I got media information from a xml file with xmllistmodel. If it's only image it's ok. But with both I got a blank area in the video space.

    My code:
    @Item {
    width: 1366
    height: 768

    Component {
        id: imageDelegate
        
        Item {
            width: 1366 
            height: 768 
            
            Image { 
                id: backgroundImage
                source: imagePath 
            }
    
            MediaPlayer {
                id: backgroundVideo
                source: videoPath
            }
    
            VideoOutput {
                anchors.fill: parent
                source: backgroundVideo
            }
    
            Component.onCompleted: {
                backgroundVideo.play();
            }
        }
    }
    
    XmlListModel {
        id: imageModel
    
        source: "http://127.0.0.1:8000/example1.xml"       
        query: "/rss/channel/item"
        
        XmlRole { name: "title"; query: "title/string()" }
        XmlRole { name: "imagePath"; query: "imagePath/string()" }
        XmlRole { name: "videoPath"; query: "videoPath/string()" }
    }
    
    ListView {
        id: listView
        clip: false
        
        anchors.fill: parent
        
        model: imageModel
        delegate: imageDelegate
    }
    

    }@

    And it's possible to autoplay video only if the item is the current one?


Log in to reply
 

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