helthans
Posts: 1
Joined: Thu Dec 05, 2013 3:20 pm

Audio in Qt5

Thu Dec 05, 2013 3:39 pm

Hi,
I have a project in Qt5, where I need to play some audio files (most likely in mp3 format). I have tried with the following code:

Code: Select all

QMediaPlayer* mediaPlayer = new QMediaPlayer;
mediaPlayer->setMedia(QUrl::fromLocalFile("/tmp/file.mp3"));
mediaPlayer->play()
Unfortunately I just get the following message and no sound:

Code: Select all

defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
I have googled this issue, and as far as I can understand, the problem is that Gstreamer (more precisely gst-omx) is not properly installed and recognized by Qt. I have tried to install gst-omx following guidelines found here:
http://creeder.com/?page=RaspberryPi
But without much luck - just keep getting that Gstreamer is not supported with running the configure script.
Can anyone tell me how I get support to Gstreamer in Qt - or is there another way around this issue of playing audio file in Qt on Raspberry Pi?

Paul Moir
Posts: 46
Joined: Wed Dec 04, 2013 7:25 pm
Location: Nova Scotia, Canada

Re: Audio in Qt5

Thu Dec 05, 2013 6:43 pm

My impression was that it wasn't done yet on the Pi for QT5. Fortunately for my app sound wasn't strictly necessary.

PS - I ran into another problem where I would get an occasional "QXcbConnection: XCB error 165" at startup. I had to put the option "Xinerama" "true" in the serverlayout section of xorg.conf.

ileon891
Posts: 2
Joined: Wed May 15, 2019 2:07 pm
Location: Buenos Aires

Re: Audio in Qt5

Wed May 15, 2019 2:09 pm

Hi,

I see this is a old post, but I have the same problem now, could you fix this problem?. I am using qt5.13.

Regards

Ivan

Return to “C/C++”