I am trying to use the QMediaPlayer in PyQt5, but it results in an error, when I call the constructor.
My system is Ubuntu 18.04, I tried the packages from Ubuntu, building PyQt5 from source and installing all packages from gstreamer, as to my knowledge, Qt uses gstreamer for playing media.
Using QMediaPlayer from c++ works without an error.
simple usage example:
from PyQt5.QtMultimedia import QMediaPlayer
mediaPlayer = QMediaPlayer(None, QMediaPlayer.VideoSurface)
resulting error:
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
Using different example codes like https://pythonprogramminglanguage.com/pyqt5-video-widget/ result in the same error.
I solved this error by deleting the PyQt packages in the python site-packages directory, so that only the PyQt packages in the python dist-packages remain.
See this link for further explanation: https://askubuntu.com/a/1038195