Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Can't get MetaData of URL using QMediaPlayer

    General and Desktop
    5
    8
    1260
    Loading More Posts
    • 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.
    • C
      CandyManJ last edited by

      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

      W 1 Reply Last reply Reply Quote 0
      • C
        CandyManJ last edited by

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

        1 Reply Last reply Reply Quote 0
        • C
          CauMoH last edited by

          The same problem on Windows. This is bug Qt.

          1 Reply Last reply Reply Quote 0
          • W
            wumpus7 @CandyManJ last edited by

            @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

            W 1 Reply Last reply Reply Quote 0
            • W
              wumpus7 @wumpus7 last edited by

              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

              jsulm 1 Reply Last reply Reply Quote 0
              • jsulm
                jsulm Lifetime Qt Champion @wumpus7 last edited by

                @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)?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  Hi,

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

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  W 1 Reply Last reply Reply Quote 2
                  • W
                    wumpus7 @SGaist last edited by

                    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

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post