Estou usando o Fedora 28. Estou tentando executar este código
from PyQt5.QtCore import QCoreApplication, QUrl
from PyQt5.QtMultimedia import QMediaContent, QMediaPlayer
from PyQt5.QtWidgets import QApplication
import sys
import os
def handle_state_change(state):
if state == QMediaPlayer.LoadingMedia:
print('loading')
if state == QMediaPlayer.LoadedMedia:
print('loading finished')
player.play()
if state == QMediaPlayer.EndOfMedia:
print('playing finished')
QCoreApplication.quit()
app = QApplication(sys.argv)
url = QUrl.fromLocalFile(os.path.abspath('./redalert.mp3'))
content = QMediaContent(url)
player = QMediaPlayer()
player.mediaStatusChanged.connect(handle_state_change)
player.setVolume(50)
player.setMedia(content)
app.exec()
No entanto, isso gera esse erro
Got keys from plugin meta data ("gstreamermediaplayer")
QFactoryLoader::QFactoryLoader() checking directory path "/home/ziggs/PycharmProjects/mozart/venv/bin/mediaservice" ...
Cannot load library /home/ziggs/PycharmProjects/mozart/venv/lib/python3.6/site-packages/PyQt5/Qt/plugins/mediaservice/libgstmediaplayer.so: (/lib64/libQt5MultimediaGstTools.so.5: version 'Qt_5_PRIVATE_API' not found (required by /home/ziggs/PycharmProjects/mozart/venv/lib/python3.6/site-packages/PyQt5/Qt/plugins/mediaservice/libgstmediaplayer.so))
QLibraryPrivate::loadPlugin failed on "/home/ziggs/PycharmProjects/mozart/venv/lib/python3.6/site-packages/PyQt5/Qt/plugins/mediaservice/libgstmediaplayer.so" : "Cannot load library /home/ziggs/PycharmProjects/mozart/venv/lib/python3.6/site-packages/PyQt5/Qt/plugins/mediaservice/libgstmediaplayer.so: (/lib64/libQt5MultimediaGstTools.so.5: version 'Qt_5_PRIVATE_API' not found (required by /home/ziggs/PycharmProjects/mozart/venv/lib/python3.6/site-packages/PyQt5/Qt/plugins/mediaservice/libgstmediaplayer.so))"
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
Eu pesquisei o erro e tentei instalar os plug-ins relevantes
dnf list qt5-qtmultimedia gstreamer-plugins-ugly
Letzte Prüfung auf abgelaufene Metadaten: vor 0:45:12 am Mo 18 Jun 2018 21:42:00 CEST.
Installierte Pakete
gstreamer-plugins-ugly.x86_64 0.10.19-27.fc28 @rpmfusion-free
qt5-qtmultimedia.x86_64 5.10.1-1.fc28 @anaconda
Verfügbare Pakete
gstreamer-plugins-ugly.i686 0.10.19-27.fc28 rpmfusion-free
qt5-qtmultimedia.i686 5.10.1-1.fc28 fedora