QMediaPlayer on Ubuntu 12.04



  • I am working on an application that needs to play various sounds for user interaction and am having trouble getting them to work on Ubuntu. I upgraded to QT5 so I could use QMediaPlayer and it works fine on Windows. However when I try to run it on my ubuntu system I get the following error when I try to load the file for playing:

    GStreamer; Unable to pause "file: beep.mp3"
    Error: "could not open resource for reading"

    and I get the following error when I try to play it:

    Gstreamer; Unable to play "file: beep.mp3"
    Error: "No URI set"

    I know the file beep.mp3 is in the correct directory because I check for it using QFile::exists. It seems like it is a GStreamer/Qt interaction problem.

    Thanks in advance!



  • Turns out that I just needed to use the absolute path.

    old code:
    player->setMedia(QUrl::fromLocalFile("beep.mp3"));

    new code
    player->setMedia(QUrl::fromLocalFile("/home/test/beep.mp3"));

    Easy fix.


Log in to reply
 

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