Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't get MetaData of URL using QMediaPlayer
QtWS25 Last Chance

Can't get MetaData of URL using QMediaPlayer

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 1.7k 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.
  • C Offline
    C Offline
    CandyManJ
    wrote on last edited by
    #1

    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
    0
    • C Offline
      C Offline
      CandyManJ
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • C Offline
        C Offline
        CauMoH
        wrote on last edited by
        #3

        The same problem on Windows. This is bug Qt.

        1 Reply Last reply
        0
        • C CandyManJ

          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 Offline
          W Offline
          wumpus7
          wrote on last edited by
          #4

          @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
          0
          • W wumpus7

            @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 Offline
            W Offline
            wumpus7
            wrote on last edited by
            #5

            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

            jsulmJ 1 Reply Last reply
            0
            • W wumpus7

              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

              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @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
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                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
                2
                • SGaistS SGaist

                  Hi,

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

                  W Offline
                  W Offline
                  wumpus7
                  wrote on last edited by
                  #8

                  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
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved