Play mp3 using Python, PyQt, and Phonon

前端 未结 3 1920
别那么骄傲
别那么骄傲 2021-02-04 17:11

I been trying all day to figure out the Qt\'s Phonon library with Python.

My long term goal is to see if I could get it to play a mms:// stream, but since I can\'t find

相关标签:
3条回答
  • 2021-02-04 17:47

    In delayedInit method; create MediaObject like following:

    def delayedInit(self):
        if not self.m_media:
           self.m_media = Phonon.createPlayer(Phonon.MusicCategory)
    
    0 讨论(0)
  • 2021-02-04 18:05

    Phonon supports different audio file formats on different platforms, using the system's own support for media formats, so it could be that your system doesn't provide libraries for playing MP3 files. Certainly, MP3 is not supported out of the box on some Linux distributions. If you are using Linux, please take a look at the following page for information about enabling MP3 support:

    http://doc.qt.io/qt-4.8/phonon-overview.html#linux

    Another way to diagnose problems with Phonon's media formats is to run the Capabilities example provided with Qt:

    http://doc.qt.io/qt-4.8///qt-phonon-capabilities-example.html

    This should tell you which media formats are supported by your system.

    0 讨论(0)
  • 2021-02-04 18:06

    If Phonon is not outputting audio or video, but not throwing any errors. You might just have to sudo apt-get install phonon-backend-gstreamer and also maybe sudo apt-get install libphonon-dev

    Phonon uses a backend of gstreamer or vlc silently, so when its not there, no errors but no functionality either. after running those commands I was able to hear sound from phonon on my raspberry pi

    Hopefully this will help someone in the future.

    0 讨论(0)
提交回复
热议问题