Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] QMediaPlayer reporting no service available in latest Qt update
I'm using Qt5.2.1 on Arch Linux. I have been developing an application that uses the QMediaPlayer class to play a video file. Everything was working fine, then about a week ago there was an update to Qt. After which I can no longer play videos and QMediaPlayer reports that no service is available. The output to the console is as follows:
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
There is nothing clear in the documentation to indicate a way to determine exactly which service it is attempting to utilize. I have the latest vlc, gstreamer and gstreamer 0.10 installed.
The documentation on multimedia appears to still refer to developing with Qt4.
The excellent documentation was one of the main reasons I began using Qt years ago. I'd like to see Qt continue to grow and succeed.
To add, the Qt VideoPlayer example produces the same result.
Fixed in recent update, Qt5.2.1-4.
Hi and welcome to devnet,
There's something not clear, do you mean an update of Arch Linux broke your application ?
It was an Arch update that updated Qt from 5.2.1-2 to 5.2.1-3.
If, what you are about to propose is that this is a subject for the associated Arch maintainer rather than for Qt, the issue still remains that when such an issue occurs, it is very difficult, if not impossible, to query enough information from the associated methods to lead one to a solution.
Is gstreamer the only supported plugin for Linux? (I would like this to be crossplatform. VLC appears to be available on virtually all platforms.) I believe the documentation, which seems to be more relevant to Qt4, also mentions support for VLC.
What is the procedure to insure that you have the correct components installed and properly configured? If more than one viable plugin is available, how does one designate which one should be used? I would think that if the compile of Qt is designated for Linux and multimedia (code containing multimedia classes all compile) support is included in the compile and gstreamer or VLC is required to make that functional, then the compile of Qt should have failed when at least one of these components were not present.
Is this a bug in the general rules for compiling Qt that would allow Qt to be compiled with multimedia support without having the required code to do anything with those classes?
As stated in the original post, everything was working prior to that last Qt update. This is indicative of the proper plugins being present on the system.
I did not compile Qt from source.
I tend to be verbose. Please don't take my lengthy reply as anything more than that.
It was not what I had in mind, just to determine if it was a Distro vs User install. However, it would indeed be useful to know what has changed between both version to help determine why it's falling now.
AFAIK, gstreamer is the official multimedia backend on linux. If someone has a VLC version, it has not been submitted yet.
As a user of a distro Qt install, the checks should have been done for you. What might happen is that you have some leftovers, did you do a complete clean build ?
Yes. I did a rebuild all, several times. I believe I also did a clean prior to one of those to make absolutely sure everything was rebuilt.
The next thing to do is check that you have all Qt plugins installed and that the multimedia plugin gets loaded
Everything worked just prior to the last Qt update. I shutdown all running programs, including Qt Creator, ran the update, brought up Qt Creator, recompiled the project and ran it. This resulted in the reported error.
I suspect the plugin may not have loaded, but what is the best way to check? I couldn't find anything in the documentation indicating how to check for this, aside from the call to isAvailable(), which I do make and now returns false.
I could change the call to, isVideoAvailable(), since that is what I want to do with the QMediaPlayer, but the error stated in the first message has already indicated that I shouldn't expect it to work and it did report "no service found".
To check which plugin is load set QT_DEBUG_PLUGINS=1
Setting the environment variable told me where it was looking. I cannot say what was there before the update, but it appears that the gstreamer plugins are not present in any of the /usr/lib/qt/plugins subdirectories. None of the names indicate they might be part of gstreamer. All gstreamer components are installed on the system. Aside from mng, I do not see any plugins related to video. Though the error is produced prior to selecting any video or even creating a VideoWidget. The only plugin in the mediaservice directory is libqtmedia_audioengine.so.
It is looking in the mediaservice directory when it fails. The message reported is exactly what was originally given,
defaultServiceProvider::requestService(): no service found for – “org.qt-project.qt.mediaplayer”
From what it looks the update failed somehow
I've done reinstalls on all the key components, but it hasn't made any difference. No indication from pacman that any issues were encountered.
Can you look into the packages content ?
Check if the multimedia package contains all plugins and compare with the previous version ?
I have contacted the maintainer of the package. They have verified the issue and submitted a correction. The latest update in Arch has fixed the issue. Something to do with the support being in QtWebKit, not in QtMultimedia. Personally, I would have expected to find it in multimedia as well.
QtWebKit needs some multimedia stuff, but indeed, it should depend on QtMultimedia in that case and not the reverse
Distro packagers have been known to move things around. For example, Ubuntu moved Qt Multimedia into Qt Mobility back in the Qt 4 days.