Page 1 of 1

Audio in Qt5

Posted: Thu Dec 05, 2013 3:39 pm
by helthans
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?

Re: Audio in Qt5

Posted: Thu Dec 05, 2013 6:43 pm
by Paul Moir
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.

Re: Audio in Qt5

Posted: Wed May 15, 2019 2:09 pm
by ileon891
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