I'm doing a school project regarding making a media player. I'm doing this with python and wxPython
as my GUI and MPlayerCtrl as my library to control all my button. However I'm having problem using MPlayerCtrl. I can't seem to get the function inside the MPlayerCtrl to work.
I am able to get the media playing but when I try to use the function "self.mplayer.GetTimeLength()"
, it's returning me with "none" which is nothing. I've also tried with other function inside MPlayerCtrl and still having the same problem. Can anyone advise me on what i am doing wrong?
A portion of the code:
def on_add_file(self, event):
"""
Add a Movie and start playing it
"""
wildcard = "Media Files (*.*)|*.*"
dlg = wx.FileDialog(
self, message="Choose a file",
defaultDir=self.currentFolder,
defaultFile="",
wildcard=wildcard,
style=wx.OPEN | wx.CHANGE_DIR
)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
self.currentFolder = os.path.dirname(path[0])
trackPath = '"%s"' % path.replace("\\", "/")
self.mplayer.Loadfile(trackPath)
t_len = self.mplayer.GetTimeLength()
print t_len
#self.playbackSlider.SetRange(0, t_len)
#self.playbackTimer.Start(100)
Reference: http://www.blog.pythonlibrary.org/2010/07/24/wxpython-creating-a-simple-media-player/