I am using PyQt5 version to develop simple Audio player but it's fail to import Phonon class.
I want to play simple mp3 file
Hope to hear from you soon
There is no Phonon in Qt5. New QtMultimedia module should be used:
import PyQt5.QtCore as C
import PyQt5.QtMultimedia as M
import sys
app=C.QCoreApplication(sys.argv)
url= C.QUrl.fromLocalFile("./some.mp3")
content= M.QMediaContent(url)
player = M.QMediaPlayer()
player.setMedia(content)
player.play()
player.stateChanged.connect( app.quit )
app.exec()
Before you ask, you need PyQt5.QtMultimedia module, witch might not be provided with PyQt5 Core library. Ubuntu have separated packed python3-pyqt5.qtmultimedia.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With