Solved QMediaPlayer::ServiceMissingError
-
Hi!
I wrote a very simple program to test QMediaPlayer, which consists of a single window with a button, and the following code is executed when I click the button:
void MainWindow::on_pushButton_clicked() { QString _file ("/var/tmp/28_94_1.wav"); qDebug() << "file = '" << _file << "'\n"; QUrl _url(QUrl::fromLocalFile(_file)); qDebug() << "url = '" << _url << "' \n"; m_player.setMedia(_url); qDebug() << "media = '" << m_player.media().canonicalUrl() << "'\n"; m_player.setVolume(80); m_player.play(); }
'm_player' is an attribute of 'MainWindow', and is created using the default constructor.
I connected a slot to the 'error' signal of QMediaPlayer:
void MainWindow::on_play_error(QMediaPlayer::Error error) { qDebug() << "error = '" << error << "'\n"; }
No sound is played, and the debug prints:
file = ' "/var/tmp/28_94_1.wav" ' url = ' QUrl("file:///var/tmp/28_94_1.wav") ' media = ' QUrl("file:///var/tmp/28_94_1.wav") ' error = ' QMediaPlayer::ServiceMissingError '
The explanation in QtCreator help for QMediaPlayer::ServiceMissingError did not help at all, and I still could not find any good hint on the internet. Does anyone know what can cause this error?
I also tried to use 'QSound', like this:
void MainWindow::on_pushButton_2_clicked() { QString _file ("/var/tmp/28_94_1.wav"); qDebug() << "file = '" << _file << "'\n"; QSound::play(_file); }
And again no sound is played.
In the 'Application Output' window, it is written:
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
And also:
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
In time, I can listen to music files using VLC or from any web site.
Does anyone have any idea that could help me?
Thanks!
-
Hi,
Which version of GStreamer do you have installed on your computer ? And which version of Qt are you using ?
-
Hi,
Qt 5.5, as Qt 5.7 is not packaged for Linux on 32 bits Intel.
There is a Ubuntu package called 'gir1.2-gstreamer-1.0', which says 'Description: GObject introspection data for the GStreamer library', and its version is '1.8.1-1~ubuntu1'.
Thanks!
-
AFAIK, Qt 5.5 uses GStreamer 0.10. So you can either install that version (plus plugins) or rebuild the QtMultimedia plugins against your installed GStreamer version.
-
So, the 'gstreamer' I have installed is newer than the Qt 5.5 requires, right? If so, shouldn't it work?
Do you think it will work on Qt 5.7?
Thanks!
-
In this case not because it's a new major release (1.0 vs 0.1). That's why the plugin doesn't load.
Since you'll be building Qt 5.7 by hand, it will pickup the your installed GStreamer and build the plugin accordingly.
-
Changing the subject to 5.7, I run 'configure', 'make' and 'sudo make install', but I did not find 'qtcreator' anywhere in the directory tree, and it is not in the $PATH. Does 'qtcreator' come in the tar.gz Qt 5.7 package?
Thanks!
-
No, Qt Creator is a younger and independent project. However you don't have to build it yourself (unless your current Qt Creator is really old).
Qt Creator can handle older as well as newer version of Qt.
-
Just checking, I need to change 'Tools/Options/Build & Run/Qt Versions', to use Qt 5.7 libs, right?
Thanks!
-
Add your self built 5.7 to the Qt Versions and then create a new Kit using it. Then you'll be able to configure and build your project with that Kit.
-
'make -j4' run for about an hour now, and finished with
'Makefile:77: recipe for target 'module-qtbase-make_first' failed
Before running 'make', I run './configure -help' and I did not see anything related to module 'qtbase'. Any ideia on what I missed?
Thanks
-
I think I found the answer at https://bbs.archlinux.org/viewtopic.php?id=191765. Well, if it works, it'll take about an hour for 'make' to run again. It's 9:30 p.m. here, so maybe I'll only have news tomorrow.
Thanks again!
-
Did you add the
-developer-build
option ? If so you should drop it unless you plan to hack on Qt itself. -
In my first attempt, I used it, but then I tried
./configure -no-warnings-are-errors -gstreamer 1.0 -prefix /usr/local/Qt-5.7 -debug
and I got the same error...
I saw somewhere someone tried with '-release -force-debug-info'. I'll try that, and let you know later.
Thanks
-
SGaist,
Thanks a lot for your help, but due to time restrictions, I gave up on installing 5.7 on a Linux on a 32 bits CPU.
I am using a Mac OS 64 bits at work now.
Thanks a lot for your help.