Errosr while running a PySide6 online audio player

37 Views Asked by At
from PySide6.QtWidgets import QApplication,QWidget,QPushButton
from PySide6.QtMultimedia import QMediaPlayer,QAudioOutput
from PySide6.QtCore import QUrl
class MainWindow(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()
        self.show()
        self.player = QMediaPlayer()
        self.audio_out = QAudioOutput()
        self.player.setAudioOutput(self.audio_out)
        self.audio_out.setVolume(0.5)

    def initUI(self):
        self.resize(400, 200)
        self.btn = QPushButton("播放",self)
        self.btn.clicked.connect(self.play)

    def play(self):
        self.player.setSource('https://m701.music.126.net/20240223181346/025e9a8822e0820ecf6f43fa8edc366b/jdymusic/obj/wo3DlMOGwrbDjj7DisKw/30458446345/5a79/d62b/d140/62fcb7b60f974f9563674da477bb6bcb.mp3')
        self.player.play()
if __name__ == '__main__':
    app = QApplication()
    window = MainWindow()
    app.exec()

Error: Could not update timestamps for skipped samples

This is a simple example where I encounter an error when I click the play button:

[mp3float @ 0000014789296DC0] Could not update timestamps for skipped samples.

I also encounter an error when I close the program:

[tls @ 00000147892B6CC0] Failed to send close message.

Could you please advise me on how to modify my code?

I have searched many web pages, but I can hardly find any relevant information related to my issue.

0

There are 0 best solutions below