Python 如果mplayer使用MplayerCtrl,则Loadlist不起作用
我在Windows和raspberry pi上使用Python2.7 我指的是下面给定的链接Python 如果mplayer使用MplayerCtrl,则Loadlist不起作用,python,mplayer,Python,Mplayer,我在Windows和raspberry pi上使用Python2.7 我指的是下面给定的链接 http://www.blog.pythonlibrary.org/2010/07/24/wxpython-creating-a-simple-media-player/ 我可以在MplayerCtrl中播放单个文件。 但当我尝试加载播放列表文件时,MplayerCtrl没有响应 下面给出的代码有效 self.mplayer = mpc.MplayerCtrl(self.panel, -1,
http://www.blog.pythonlibrary.org/2010/07/24/wxpython-creating-a-simple-media-player/
我可以在MplayerCtrl中播放单个文件。
但当我尝试加载播放列表文件时,MplayerCtrl没有响应
下面给出的代码有效
self.mplayer = mpc.MplayerCtrl(self.panel, -1, mplayerpath)
..
..
..
self.mplayer.Loadfile('I:\Outputsync.avi')
self.playbackTimer.Start(100)
self.mplayer.Start()
另一种方法也有效-
subprocess.call('mplayer.exe -playlist I:\playlist.txt -shuffle' ,shell=False)
import wx
import MplayerCtrl as mpc
class Frame(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id)
self.mpc = mpc.MplayerCtrl(self, -1, u'mplayer.exe')
#wx.FutureCall(2500, self.mpc.Loadfile, u'Outputsync.avi')
wx.FutureCall(2500, self.mpc.Loadlist, u'I:/playlist.txt')
self.Show()
if __name__ == '__main__':
app = wx.App(redirect=False)
f = Frame(None, -1)
app.MainLoop()
未来电话也起作用-
subprocess.call('mplayer.exe -playlist I:\playlist.txt -shuffle' ,shell=False)
import wx
import MplayerCtrl as mpc
class Frame(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id)
self.mpc = mpc.MplayerCtrl(self, -1, u'mplayer.exe')
#wx.FutureCall(2500, self.mpc.Loadfile, u'Outputsync.avi')
wx.FutureCall(2500, self.mpc.Loadlist, u'I:/playlist.txt')
self.Show()
if __name__ == '__main__':
app = wx.App(redirect=False)
f = Frame(None, -1)
app.MainLoop()
但是这个代码不起作用
import MplayerCtrl as mpc
self.mplayer = mpc.MplayerCtrl(self.panel, -1, mplayerpath)
..
..
..
self.mplayer.Loadlist('I:\playlist.txt',1)
self.playbackTimer.Start(100)
self.mplayer.Start()
这一个返回“无”
import MplayerCtrl as mpc
def on_add_file(self, event):
self.mplayer = mpc.MplayerCtrl(self.panel, -1, mplayerpath)
..
..
..
mpc.MplayerCtrl.Loadlist(self.mplayer,'I:\playlist.txt',1)
self.playbackTimer.Start(100)
self.mplayer.Start()
请给我一些提示,我哪里做错了。我得到了答案
文件名之前缺少unicode前缀
import MplayerCtrl as mpc
def on_add_file(self, event):
self.mplayer = mpc.MplayerCtrl(self.panel, -1, mplayerpath)
..
..
..
subprocess.call('mplayer.exe -playlist I:\playlist.txt -shuffle' ,shell=False)
self.mplayer.Loadfile(u'I:/Outputsync.avi')
self.mplayer.Loadlist(u'I:/playlist.txt',1)
mpc.MplayerCtrl.Loadfile(self.mplayer,u'I:/Outputsync.avi')
mpc.MplayerCtrl.Loadlist(self.mplayer,u'I:/playlist.txt',1)
wx.FutureCall(1, self.mplayer.Loadlist, u'I:/playlist.txt' , 1)
self.playbackTimer.Start(100)
self.mplayer.Start()