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. QMediaPlayer Documentation is wrong, or am I ?
Forum Updated to NodeBB v4.3 + New Features

QMediaPlayer Documentation is wrong, or am I ?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 862 Views 1 Watching
  • 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.
  • G Offline
    G Offline
    ghidx0
    wrote on last edited by
    #1

    I was hoping that someone here could check my thinking. As far as I can tell, the Docs for QMediaPlayer appear to have a typo at the first example under details

    player = new QMediaPlayer;
    connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
    player->setMedia(QUrl::fromLocalFile("/Users/me/Music/coolsong.mp3")); # <- Here's the error
    player->setVolume(50);
    player->play();
    

    player->setMedia appears to have the following signature: void setMedia(const QMediaContent &media, QIODevice *stream = Q_NULLPTR) while QUrl::fromLocalFile returns a QUrl

    I'm new to Qt, so, I don't want to run off half-cocked and report an issue. I'll do so, but am I seeing this right ?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Nothing to do with Qt.

      See the second constructor of QMediaContent. It takes a QUrl so basically what happens is that you have a QMediaContent automatically created from the QUrl.

      See converting constructor for more information.

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

      G 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi and welcome to devnet,

        Nothing to do with Qt.

        See the second constructor of QMediaContent. It takes a QUrl so basically what happens is that you have a QMediaContent automatically created from the QUrl.

        See converting constructor for more information.

        G Offline
        G Offline
        ghidx0
        wrote on last edited by
        #3

        @SGaist Thanks, that clears that up for me. I didn't ask about it, to keep the question concise, but now I see how this complicates translating the example into the PyQt5 bindings, which is what I'm working through. So this explains why a c++ application could successfully mimic that example, but a PyQt5 binding application could not. Excellent answer, thanks again for the help.

        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