我正在尝试在mac上使用带有pyside的声子。我希望能够在带有pyside的桌面应用程序中在小部件中播放快速电影。
我通过macports从源代码安装了phonon,qt和pyside
$ sudo port -s -v install phonon qt4-mac
$ sudo port -s -v install py27-pyside
我可以按照以下方式确认安装
$ port installed phonon qt4-mac
The following ports are currently installed:
phonon @4.6.0_1 (active)
qt4-mac @4.8.5_0 (active)
我发现了一些简单的代码来测试它..
import sys
from PySide import QtCore, QtGui
from PySide.phonon import Phonon
app = QtGui.QApplication(sys.argv)
testPlayer = Phonon.VideoPlayer()
testMedia = Phonon.MediaSource('/path/to/media/test_MOV.MOV')
testPlayer.load(testMedia)
testPlayer.play()
testPlayer.show()
sys.exit(app.exec_())
然而,在pycharm中运行代码时会出现以下错误。
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
WARNING: Phonon needs QCoreApplication::applicationName to be set to export audio output names through the DBUS interface
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
WARNING: Phonon::createPath: Cannot connect Phonon::MediaObject ( no objectName ) to Phonon::AudioOutput ( no objectName ).
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
WARNING: Phonon::createPath: Cannot connect Phonon::MediaObject ( no objectName ) to Phonon::VideoWidget ( no objectName ).
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
看起来后端工作不正常,而且声音没有连接到quicktime?如果是这种情况,我能解决这个问题吗?我该如何设置插件路径? - 我找不到osx的信息。
或者另外还有另一种更好的方法可以在pyside中播放音频而不是声音吗?
提前感谢。
答案 0 :(得分:0)
运行以下命令,似乎列出了这些命令,但未加载
sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist
sudo launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist