wx.media.MediaCtrl EVT_MEDIA_LOADED on Windows, plus a Timer events question

I'm using Python 3.7 and wxPython 4.0.6. I use the same code on both MacOS and Windows.

tldr:

Can anyone confirm for me that wx.media.EVT_MEDIA_LOADED does not get called on Windows?

Also, there are some instances where my EVT_TIMER events are not getting fired. Do Timer events depend on idle time to fire?

Long version:

For the last 20 years, I've written and maintained a cross-platform program that specializes in the academic analysis of the contents of video and audio data. I have relied upon a 32-bit Python 2.7 wxPython 3.0.2.0 version of my software for the last several years, and am finally taking the plunge to upgrade to Python 3.7 wxPython 4.0.6.

One feature of my software is that it supports multiple simultaneous media files. I have historically relied on the EVT_MEDIA_LOADED event to allow me to wait for large data files to load before working on tasks relating to synchronizing the files into a visually unified data stream. Sometimes files are very large, sometimes there are multiple files, and sometimes files must be pulled off a network server, which slows the load process down. EVT_MEDIA_LOADED has historically worked very well for this.

At present, my EVT_MEDIA_LOADED handler never gets called on Windows like it does on MacOS. Is that event handler broken on Windows in wxPython 4.0.6?

I am also noticing that EVT_TIMER events don't seem to fire 100% of the time. They work perfectly most of the time, but every once in a while, they fail. My current hypothesis is that this happens primarily during the loading of some media files sometimes. (The failure is sporadic, inconsistent, and hard to reproduce across test runs. It only happens with some files, only with video as opposed to audio, and only with certain video formats, perhaps different formats on different OSes. It also might be more likely the first time I load a file after I've taken a break, when maybe the computer or network doesn't have the data cached.) I think I've noticed that my wx.EVT_IDLE events are not firing when the timers fail, but I'm still working to confirm that. EVT_IDLE call frequency also varies a surprising amount based on media formats.

(I originally tried to use Timers to track media position, as was in multiple sample programs I found. When that wasn't completely reliable, I shifted to a wx.EVT_IDLE model. It's better, but still not perfect.)

So are Timers linked to idle time? Does this make any sense? Does anyone have any alternate theories for me to look into?

Thanks in advance,

David

···

--
David K. Woods, Ph.D.
President, Researcher, and Lead Transana Developer
https://www.transana.com

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/4206aaf8-bd37-cccc-2dc3-200f455d7a96%40gmail.com.

I'm using Python 3.7 and wxPython 4.0.6. I use the same code on both MacOS and Windows.

Can anyone confirm for me that wx.media.EVT_MEDIA_LOADED does not get called on Windows?

This one I do not know.

Also, there are some instances where my EVT_TIMER events are not getting fired. Do Timer events depend on idle time to fire?

Yes. Most window messages in Windows are placed in a queue, so if they fire multiple times, you’ll get multiple calls. But WM_PAINT and WM_TIMER are handled differently. Instead of being queued, they just set a flag in the window data structure. When the message queue goes empty, GetMessage will check to see if either the WM_PAINT or WM_TIMER flag is set, and if it is, it will dispatch the message.

So, if you receive six WM_TIMER (or WM_PAINT) hits before you empty your message queue, you’ll only get one dispatch.

···

On Aug 12, 2019, at 12:15 PM, Transana <transana@gmail.com> wrote:

Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/C59FFDFE-D282-472D-96C4-B1C9C93C9D2E%40probo.com.

It may depend somewhat on the mediactrl backend in use, but I see calls to NotifyMovieLoaded in all the MSW backends, and that is where the EVT_MEDIA_LOADED event is sent from. So it looks like it is at least intended for it to be sent, but there could be some reason it is not getting to the point where NotifyMovieLoaded is sent. For example, there is a comment in the MP10 backend that indicates that the wxWidgets code might not be called until the movie is “about to play.”

···

On Monday, August 12, 2019 at 1:46:27 PM UTC-7, Tim Roberts wrote:

On Aug 12, 2019, at 12:15 PM, Transana transana@gmail.com wrote:

I’m using Python 3.7 and wxPython 4.0.6. I use the same code on both MacOS and Windows.

Can anyone confirm for me that wx.media.EVT_MEDIA_LOADED does not get called on Windows?

This one I do not know.

Robin

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/37966cb7-717f-45c5-be3c-b7732b01be12%40googlegroups.com.

– You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to .
To view this discussion on the web visit .

···

On 8/13/19 11:40 AM, Robin Dunn wrote:

    On Monday, August 12, 2019 at 1:46:27 PM UTC-7, Tim

Roberts wrote:

      On Aug

12, 2019, at 12:15 PM, Transana <transana@gmail.com >
wrote:

      >

      > I'm using Python 3.7 and wxPython 4.0.6.  I use the same

code on both MacOS and Windows.

      >

      > Can anyone confirm for me that wx.media.EVT_MEDIA_LOADED

does not get called on Windows?

      This one I do not know.
      It may depend somewhat on the mediactrl backend in use, but

I see calls to NotifyMovieLoaded in all the MSW backends, and
that is where the EVT_MEDIA_LOADED event is sent from. So it
looks like it is at least intended for it to be sent, but
there could be some reason it is not getting to the point
where NotifyMovieLoaded is sent. For example, there is a
comment in the MP10 backend that indicates that the wxWidgets
code might not be called until the movie is “about to play.”

Thanks Robin and Tim.

  Getting consistent behavior across platforms and media formats

has been really tricky, even just using the WMP10 backend on
Windows and the QuickTime back end on MacOS. Having wx.media
events and wx.Timer events behaving inconsistently adds to the
challenge, but it kind of makes sense that these problems are tied
to the quirks of different media formats. I’m really close to
getting what I want using flag variables and EVT_IDLE processing.
It’s inelegant at times, especially when I load videos from a
server for the first time which causes a long wait for necessary
information to become available.

  And unfortunately, GetBestSize() doesn't appear to be working on

Windows either. I get (20, 20) for everything.

David

-- David K. Woods, Ph.D.
President, Researcher, and Lead Transana Developer

wxpython-users+unsubscribe@googlegroups.com
https://groups.google.com/d/msgid/wxpython-users/25f7130d-ed8d-9241-6df3-bd475dd0ec13%40gmail.com
https://www.transana.com