Can't get MetaData of URL using QMediaPlayer



  • Hi,

    So my problem is that I can't get the MetaData of an MP3 file when opening a file online using Player->setMedia(QUrl(url))

    I can get the metadata without problems if I load a local file, but it does not work with URLs (I use QUrl::fromLocalFile to load local files). The QMediaPlayer is connected to a metaDataAvailableChanged(bool) slot.

    I tried uploading an MP3 to my own FTP server and chmod it to 777 (In case it was a problem related to access and permissions) but couldn't get the MetaData.

    I can play the media without problems, but I can't get the Title, Duration,etc...

    So is this a bug or am I missing a step to do when loading from URLs?

    Best,
    MJaoune



  • Bump.... The only thread not to be answered in the list...



  • The same problem on Windows. This is bug Qt.



  • @candymanj said in Can't get MetaData of URL using QMediaPlayer:

    So my problem is that I can't get the MetaData of an MP3 file when opening a file online using Player->setMedia(QUrl(url))

    Oh, look, that's the same problem I'm having... Scary that there are no replies to this post from five years ago. Maybe I can access the file locally?

    Thanks,
    Alex



  • setMedia requires an object of type QMediaContent, which can only be constructed from URLs or QMediaPlaylists. QMediaPlaylists can only be constructed from QMediaContent or lists of QMediaContent... How the heck can you not use a URL?

    That is, what does it mean to 'load a local file'?

    Thanks,
    Alex


  • Qt Champions 2018

    @wumpus7 Please read documentation (https://doc.qt.io/qt-5/qurl.html): QUrl can be local file.

    url = QUrl("/home/user/file.txt");
    

    "That is, what does it mean to 'load a local file'?" - file located on the machine (not somewhere on network/Internet)?


  • Lifetime Qt Champion

    Hi,

    In addition to @jsulm, QUrl::fromLocalFile is usually a good idea when dealing with files on your machine through QUrl.



  • The OP seemed to be making a distinction between URLs and local files. The files I am using are local files; the URLs are created using QUrl::fromLocalFile. I thought that there might be some way that I could solve my issue of not being able to get metadata from the files if I somehow made them 'more local', but I don't see any method of doing that.

    Thanks,
    Alex


 

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