You might get this error after you add a new variable to your C++ code that you want to be accessible in an Unreal Engine Blueprint. This can be done by using the UPROPERTY(EditAnywhere, BlueprintReadWrite) macro. After rebuilding your solution, you probably expect the variable to be available to the Blueprint right away (and it may very well be), but you might be surprised that sometimes you get runtime errors like this not only for the variables that were already Blueprint-accessible and working properly but also the new one(s). Searching the Internet for a solution didn’t offer much help. So, what’s the solution? Although you might expect that building the C++ solution also compiles the Blueprints, this is not always the case. Although Blueprints are turned into C++ classes through a process called Blueprint Nativization, the Blueprints are not always recompiled when you compile the C++ solution. And it seems that this is a long-standing problem (or bug). After adding the new Blueprint-accessible variable to your C++ class and compiling it, make sure you recompile the Blueprint itself from the Blueprint Editor. If you have multiple Blueprints that are suddenly showing this error, you can also right-click on the Blueprints, go to “Asset Actions”, click on “Reload”, then recompile the Blueprints. The variable should then be available to the Blueprint.
How to solve no service found for – org.qt-project.qt.mediaplayer
If you deploy a Qt Multimedia project to a Linux distro, you might come accross this error message:
defaultServiceProvider::requestService(): no service found for – “org.qt-project.qt.mediaplayer”
The error occurs when there are Qt plugins that are either missing from the files you deployed, or their dependencies on the distro are not installed.
Qt Multimedia platform uses the Gstreamer multimedia framework. So, the first place to look is to make sure that you install all the Gstreamer files that your Qt Multimedia program might need. There are several libraries available for GStreamer. The Qt documentation says that you need to install even the “ugly”, “good”, “bad”, and ffmpeg and libav libraries.
To build Qt Multimedia, you need the GStreamer library, base plugins, and development files for your system. To run applications that use Qt Multimedia, you might also need to install the following GStreamer plugins: ‘good’, ‘ugly’, ‘bad’, ffmpeg (0.10), and libav (1.x). These additional plugins contain various codecs for audio and video decoding, as well as the necessary components for using the camera APIs. The package names for GStreamer vary between Linux distributions; try searching for
gstreamer
orlibgstreamer
in your distribution’s package repository to find suitable packages.
Here is a command to install many of these libraries at once with yum:
yum install gstreamer1-devel gstreamer1-plugins-base-tools gstreamer1-devel-docs gstreamer1-plugins-base-devel gstreamer1-plugins-base-devel-docs gstreamer1-plugins-good gstreamer1-plugins-good-extras gstreamer1-plugins-ugly gstreamer1-plugins-ugly-devel-docs gstreamer1-plugins-bad-free gstreamer1-plugins-bad-free-devel gstreamer1-plugins-bad-free-extras
If you are still getting the error after installing the GStreamer libraries, then you should look at the Qt Multimedia plugins you deployed with your program.
The easiest way to find out if one of your libraries is not being loaded properly by the program is to set the QT_DEBUG_PLUGINS to a non-zero value. This will make the program print debug information about the libraries it is loading during runtime.
You can set the QT_DEBUG_PLUGINS environment variable with the export command:
export QT_DEBUG_PLUGINS=1
You can check to see if the variable has been set with the command:
echo $QT_DEBUG_PLUGINS
Which should print: 1
If you run your program from the terminal, you will now see debug information about the plugins being loaded. If a plugin that is needed was not loaded, the program should print its name and where it looked for the plugin.
In my case, the debug information showed that the “mediaservice” folder was not deployed. After adding it to the deployed files, the debug information showed that the “libqgsttools_p” libraries were not loading properly.
I had to run the command: ldd libgstmediaplayer.so from the mediaservice directory to find out which dependencies were still missing. The libQt5MultimediaWidgets.(*) files and the libqgsttools_p.(*) files were missing from the /lib directory. The mediaservice folder was also missing from the plugins directory.
It turns out that the linuxdeployqt tool I used to package the libraries and create the AppImage file did not include the missing files. You can find the “mediaservice” folder and other missing libraries under your Qt installation. To avoid this error, you need to make sure they are deployed with your program.
After installing the missing Qt Multimedia files, your program should be able to run.