我正在尝试在mac上使用带有pyside的声子。我希望能够用pyside在桌面应用程序的小部件中播放快速电影。
我通过macports 从源安装了声子、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中使用音频而不是声子来快速播放?
提前谢谢。
运行以下命令,这些命令似乎已列出,但未加载
sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist
sudo launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist