>>> That got it working on XP with wxPython 2.8.7.1. I loaded
>> Python and
>>> wxPython on my Vista machine, and sure enough, even with
the older
>>> wxPython, the EVT_MEDIA_LOADED event doesn't fire. So
that leaves
>>> me
>>> wondering why my
>>> app DOES work on Vista. (It's py2exe'd and much more
convoluted,
>>> but it
>>> works.)
>>>
>>> Unfortunately, I've run out of time to look into it for
you. I've
>>> got to get back on the clock now. I'll try to steal a bit more
>> time in the
>>> next
>>> few days.
>>
>> thanks for the effort.
>> Tomorrow I'll try it on XP and see if there is a difference.
>
>
> The mystery deepens.
>
> I found and fixed a bug in my program, meaning I had to do a new
> build, so I added code to confirm that the EVT_MEDIA_LOADED
event was
> firing while I was at it. It does fire, even on Vista, reliably.
>
> I'll spend some time tomorrow working on why.
Do you use a non-default media player back-end?
Robin,
Correct as usual. That's exactly the missing element.
Boštjan,
The following code loads and plays a video file, even on Vista, at least
under wxPython 2.8.7.1-unicode.
import wx
import wx.media
class DemoFrame(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id)
self.mp = wx.media.MediaCtrl(self, fileName='./demo.mpg',
szBackend=wx.media.MEDIABACKEND_WMP10)
self.mp.Bind(wx.media.EVT_MEDIA_LOADED,self.OnPlay)
def OnPlay(self,event):
print "playing"
self.mp.Play()
app = wx.PySimpleApp()
frame=DemoFrame(parent=None,id=-1)
frame.Show()
app.MainLoop()
My suspicion is that MEDIABACKEND_DIRECTSHOW is the default back end on
Windows. If I understand things correctly, MEDIABACKEND_DIRECTSHOW relies
on the WMP 6.5 engine, which is included with Win2K and XP, but not with
Vista. Vista starts with the WMP 9/10 engine.
Just a side note, I find that SetPlaybackRate() doesn't work with the
MEDIABACKEND_WMP10 backend, though it does with MEDIABACKEND_QUICKTIME and
MEDIABACKEND_DIRECTSHOW. I also find that occasionally, but not reliably,
my program crashes when switching between the QuickTime and one of the WMP
back ends. Just crashes, taking everything down with it with no error
trapping possible. I haven't found a work-around to either of these
problems.
David