Video playback influenced by amount of time webpage is open

I have a simple webpage stored on my local computer. This page contains some text and references a number of video files. The video files are also stored on my local computer: in the same directory as the HTML webpage. The video files are H.264 encoded and have a bit rate of around 125 kbps.

Here is a snippet of the HTML that loads one of the video files:

<video src="AddRowsExcel.mp4" poster="AddRowsExcel.png" controls>
Your browser does not support the video tag.

When I use wxdemo and use the “HTML2_WebView” control, I find that the longer I wait on the page before clicking the play button on one of the videos, the longer it takes before playback starts once I click the play button.

For example, the webpage loads, I scroll down to the video and click its “Play” button, then there is a delay of about 1 or 2 seconds before the video actually starts playing.

When I load the webpage and wait 15 seconds before I click the “Play” button, then there is a delay of about 15 seconds before the video actually starts playing. Wait 60 seconds, hit “Play”, then playback starts after about a minute, etc.

In my own program, I tried different WebView backends, like WebViewBackendWebKit (the one I used initially and am still using), WebViewBackendWebGTK, WebViewBackendWebGTK3 and WebViewBackendPygObject. None of them resolves the issue.

I am using wxPython 4.2.1, Python 3.11.9 and Ubuntu 22.04.

Any ideas on what could be causing this?

Thank you.


I came across this problem on Linux a while ago. In my case it was using the MediaCtrl. I never did find a solution.

I raised an issue for it in the wxPython GitHub repo, but sadly got no replies.

Some additional information. I tried the different backends because I don’t experience the issue when running on Windows.

@RichardT I just left a +1 on your Github issue. Hopefully this helps to bring it to the attention of the developers and if they have time, perhaps a solution can be found.