MediaCtrl Seek() and Tell() - Part 2

I’m seeing a strange issue with the MediaCtrl on Windows 10 using Python 3.7 and wxPython 4.1.1a1 daily builds.

When I create a MediaCtrl without specifying a backend on Windows, (i.e. =, the assigned EVT_MEDIA_LOADED method never gets called. However, Seek() and Tell() agree nicely with each other, as they should.

But in my application, I need EVT_MEDIA_LOADED to work (Historically, users could select different backends on Windows, but that’s not really a thing any more.) When I add the szBackend parameter to my MediaCtrl specification, EVT_MEDIA_LOADED does get called, but if I Seek(), the media position is always set exactly 1 second before the correct position, as shown by a Tell() call and by actually playing the media file.

I’ve attached a sample program that demonstrates this. At the top of the file, you’ll need to adjust the WINFILE variable to point to a media file on your computer. The USE_BACKEND_ON_WIN variable determines whether the szBackend parameter is used or not for comparison purposes. The EVT_MEDIA_LOADED event shows the difference between a Seek() call and a Tell() call, and the Test button does a series of Seek()s and Tell()s and reports the results via print().

My first question is whether this is a wxPython issue or a wxWidgets issue. Based on our experience with macOS, I’d guess the later.

Thanks in advance for taking a look,

David (3.8 KB)

Are you sure about there only being one MediaCtrl backend on Windows? It seems that QUICKTIME and DIRECTSHOW might still be there? I can’t seem to find where the default is specified though.

This is most likely in wxWidgets too. I can’t see how the bindings could be changing behavior here.

Hi Scott,

  QUICKTIME is no longer an option on Windows.  (Apple stopped

supporting QuickTime for Windows, it has known security issues,
etc.) WMP10 and DIRECTSHOW are both options. The latest wxPython

Use ActiveMovie/DirectShow. Uses the native ActiveMovie (I.E.
DirectShow) control. Default backend on Windows and supported by
nearly all Windows versions.


So you are probably getting DIRECTSHOW when EVT_MEDIA_LOADED is not working.

Yes. But if I select DIRECTSHOW intentionally through szBackend,
EVT_MEDIA_LOADED fires. In my program, but not the sample app,
the media file won’t load at all if I don’t specify a backend. I
haven’t really pursued that yet, though, since it does work in the
sample app.