[PySide] QMediaPlayer cannot play mp3 audio files

Zhao Lee redstone-cold at 163.com
Mon Nov 7 10:21:14 CET 2022


QMediaPlayer cannot play mp3 audio files, no sound,。
Tested with the latest PySide on win11


from PySide6.QtCore import*
from PySide6.QtGui import*
from PySide6.QtWidgets import*
from PySide6.QtMultimedia import*


import sys



classMainWindow(QMainWindow):  #


    def__init__(self, parent=None):
        super().__init__(parent)


        player =QMediaPlayer()
        # player.setSource(QUrl('http://dict.youdao.com/dictvoice?audio={}&type=2'.format('good')))
        player.setSource(QUrl('https://files.51voa.cn/202211/millions-of-americans-will-not-vote-in-english-on-election-day.mp3'))
       
        player.play()



if __name__ =="__main__":


    app =QApplication(sys.argv)
    MainWindow =MainWindow()
    MainWindow.show()
    sys.exit(app.exec())

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20221107/06d05708/attachment.htm>


More information about the PySide mailing list