Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. unable to set the pipeline to the paused state (Qt Multimedia Player)

unable to set the pipeline to the paused state (Qt Multimedia Player)

Scheduled Pinned Locked Moved Solved Qt for Python
7 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wajahat raza
    wrote on last edited by
    #1

    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.2

    I 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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • W Offline
        W Offline
        wajahat raza
        wrote on last edited by
        #3

        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())
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You forgot to put the installation instructions you used.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          W 1 Reply Last reply
          0
          • SGaistS SGaist

            You forgot to put the installation instructions you used.

            W Offline
            W Offline
            wajahat raza
            wrote on last edited by
            #5

            @SGaist I did install pyside6 from pip, using the 'pip install pyside6' command.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You marked the thread as solved, can you share what you did that fixed the issue ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • W Offline
                W Offline
                wajahat raza
                wrote on last edited by
                #7

                That issue was related to the file path of the '.mp3' file.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved