0

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.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Stefan
  • 100
  • 2
  • 10
  • Possible duplicate of [QMediaPlayer doesn't play anything on Ubuntu 16.04 / Qt 5.6](https://stackoverflow.com/questions/39563308/qmediaplayer-doesnt-play-anything-on-ubuntu-16-04-qt-5-6) – eyllanesc Oct 15 '18 at 05:50

1 Answers1

0

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

Stefan
  • 100
  • 2
  • 10