unable to set the pipeline to the paused state (Qt Multimedia Player)
-
I developed a small app to test the QMediaPlayer features in Python.
My environment is:
Linux Mint 20
Python version 3.9.7
pyside version 6.2I am unable to play the local mp3 file, as qt. multimedia.player generates the message "Unable to set the pipeline to the paused state'.
Please assist me to resolve the problem.
Thanks. -
Hi and welcome to devnet,
Please add the script you are using so that people can test it on their machine.
Also, how did you install PySide6 ?
-
Following is the code that I am using:
import sys, os from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QVBoxLayout from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput from PySide6.QtCore import QUrl, Slot class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.player = QMediaPlayer() self.audio = QAudioOutput() self.player.setAudioOutput(self.audio) play_btn = QPushButton('Play Audio') play_btn.clicked.connect(self._play_audio_file) self.setCentralWidget(play_btn) def _play_audio_file(self): self.player.setSource(QUrl.fromLocalFile('/home/wraza/Qt-Projects/shorthand-app-api/static/audios/MainDhoondneKoZamaaneMein.mp3')) self.player.play() if __name__ == "__main__": os.environ["QT_SCALE_FACTOR"] = "2" app = QApplication([]) app.setStyle('Fusion') app_window = MainWindow() app_window.show() sys.exit(app.exec()) -
You forgot to put the installation instructions you used.
-
@SGaist I did install pyside6 from pip, using the 'pip install pyside6' command.
-
You marked the thread as solved, can you share what you did that fixed the issue ?
-
That issue was related to the file path of the '.mp3' file.