PyQt5 QMediaPlayer defaultServiceProvider::requestService(): 서비스를 찾을 수 없음 - "org.qt-project.qt.mediaplayer"

PyQt5 QMediaPlayer defaultServiceProvider::requestService(): 서비스를 찾을 수 없음 - "org.qt-project.qt.mediaplayer"

저는 페도라 28을 사용하고 있습니다. 이 코드를 실행하려고 합니다.

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()

그러나 이 오류가 발생합니다.

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"

오류를 검색하고 관련 플러그인 설치를 시도했습니다.

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   

답변1

Qt5.10에서도 동일한 문제가 있습니다.

제대로 작동하려면 Qt5.8로 돌아가야 합니다.

관련 정보