I am working with PyQt5 and trying to play a video on my Python application.
I am using Python 3.4.0 and PyQt 5.2.1 and running the application on Ubuntu 14.04, but it id important to make codes cross-platform.
When I run these codes, I get the error of
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
My codes:
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
import PyQt5.QtMultimedia as M
class Form(QWidget):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
self.setWindowTitle("IKA Control Panel")
url= QUrl.fromLocalFile("./some.mp3")
content= M.QMediaContent(url)
self.player = M.QMediaPlayer(self)
self.player.setMedia(content)
self.player.play()
self.player.stateChanged.connect( app.quit )
if __name__ == '__main__':
import sys
app = QApplication(sys.argv)
screen = Form()
screen.show()
sys.exit(app.exec_())
How can I solve this problem?