Regarding music art in QML



  • Hi all,
    I am developing a music player in qml, as all common music players have musicart( the particular song poster if available), i also want to have musicart replaced with my common music note image in the music player. but i don't know how to replace the image with the particular musicart automatically for each song which will be selected to play.
    Can anyone please suggest me what i need to do?
    Thanks


  • Moderators

    @Naveen_D So have you found a way to extract albumart? If yes, then its just the question of changing the image, isn't it ?



  • @p3c0

    So have you found a way to extract albumart?

    No, this only i want to know how to extract the albumart, how can i do that ?



  • You haven't provided much information about what data is available to your QML object.

    It seems like essentially you would want to bind the musicart file path to the source property of a QML Image{ }

    Image{
       source: dynamicFilePath
    }
    

    You could have your default musicart behind the dynamic musicart, and when the filepath is blank you should see your default music art
    otherwise you can bind the Image's visible property like this

    visible: source!=""
    
    Image{
       source: "defaultMusicArt.jpg"
    }
    Image{
       source: dynamicFilePath
       visible: source!="" //this line is probably not necessary
    }
    

    you could even use a single Image and a ternary operator when setting (binding) the source property

    Image{
       source: dynamicFilePath==""?"defaultMusicArt.jpg":dynamicFilePath
    }
    

    If you require a less vague answer, you must provide a less vague question.


  • Moderators

    @Naveen_D Check this.



  • Hi, how to get the coverartURL for a media or song. i tried with the following piece of code but didn't get the output.

    Commonrectangle {
                    id: musicartrect
                    rectWidth: (musicMainrectangle.width/3)
                    rectHeight: musicMainrectangle.height/2
                    rectColor: "transparent"
                    BorderImage {
                        id: coverBorder
                        source: "qrc:/images/cover_overlay.png"
                        anchors.fill: parent
                        anchors.margins: 4
                        border {left: 10; top:10; right:10; bottom: 10}
                        horizontalTileMode: BorderImage.Stretch
                        verticalTileMode: BorderImage.Stretch
                        Image {
                            id: coverPic
                            anchors.centerIn: parent
                            source: musicplayer.metaData.coverArtUrlLarge? musicplayer.metaData.coverArtUrlLarge : "qrc:/images/music_icon.png"
                            anchors.fill: coverBorder
                            anchors.margins: 2
                        }
                    }
                }
    

    can anyone tell me what is wrong here ? Thanks



  • Hi, is there any update on the above thread, Thanks


Log in to reply
 

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