Unable to use Qt Multimedia in Qt 5.6.3 on Ubuntu 20.04.6 LTS: "No service found for - org.qt-project.qt.mediaplayer"
-
I'm new to Qt, and I'm currently using version 5.6.3 on Ubuntu 20.04.6 LTS. Due to reasons, I cannot upgrade to a newer version of Qt. I'm building a video player and trying to use the Qt Multimedia module, but I'm encountering the following error:
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
I am trying to run the following code:
import QtQuick 2.5 import QtMultimedia 5.6 import QtQuick.Controls 2.0 ApplicationWindow { visible: true width: 640 height: 480 title: "Video Player" MediaPlayer { id: mediaPlayer source: "file:///path/to/your/video.mp4" autoPlay: false } VideoOutput { id: videoOutput anchors.fill: parent source: mediaPlayer fillMode: VideoOutput.PreserveAspectFit } Slider { id: slider width: parent.width maximumValue: mediaPlayer.duration value: mediaPlayer.position onValueChanged: { if (!slider.isPressed) { return; } mediaPlayer.position = slider.value; } } Row { id: controls anchors.bottom: parent.bottom spacing: 10 Button { id: playButton text: mediaPlayer.playbackState === MediaPlayer.PlayingState ? "Pause" : "Play" onClicked: { if (mediaPlayer.playbackState === MediaPlayer.PlayingState) { mediaPlayer.pause(); } else { mediaPlayer.play(); } } } Button { text: "Stop" onClicked: mediaPlayer.stop() } } }
I've tried several things to resolve this issue:
I checked the output of ldd libgstmediaplayer.so and found that the system is unable to find the GStreamer 0.10 libraries. However, I have GStreamer 1.x installed on my system, as confirmed by the output of gst-inspect-1.0.
I tried to install GStreamer 0.10 using the following command, but the packages were not found: sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
I attempted to rebuild Qt 5.6 with GStreamer 1.x support. I downloaded the Qt 5.6 source code, installed the necessary dependencies, set the PKG_CONFIG_PATH environment variable, and ran the configure script with the -gstreamer 1.0 option. However, I encountered an error saying that /home/user/qt-everywhere-opensource-src-5.6.3/qtbase/configure was not found.
I'm at a loss for what to do next. Any help would be greatly appreciated.
-
Hi,
You should start with a fresh source tree. If configure is not there then there's an issue with.
I would also recommend using an out of source build so if something goes wrong you can just start from fresh more easily.
-
@SGaist Umm I am a beginner and am not exactly sure what you want me to do. From what I understand, a fresh source tree is making a new project. And I haven't done anything related to out of source builds. So, would you please elaborate?
-
I meant with regards to your build of Qt 5.6. Grab the sources anew and redo the build steps from a freshly decompressed source tree.
-
@SGaist Hey, I tried this, but it didn't work. Some of my colleagues mentioned it is a license problem. So, is that true?
Also, I tried this in Windows using the 5.6.3 MinGW build, and it worked fine. I am guessing the best way would be to upgrade the Qt version for Ubuntu, or is there any other way I can try?
-
There's no particular license required to use the QtMultimedia module. It's likely a detection issue at configuration time. Do you have the GStreamer development packages installed ?
-
One possible alternative could be to use a Docker container to build your application with a suitably old Ubuntu or maybe a VM which would be even simpler,