Video fails to download after many trials

OS: Windows 11
PsychoPy version: 2025.1.1
Browsers: Chrome, OperaGX, Firefox

I’m making an experiment where the participant is shown many short videos (a little less than 300 clips, each about 3 seconds long, whole thing is 166MB in size). At around the 40th video or so, the next one fails to download. There’s no error, the request just stalls indefinitely. I’m testing this locally, so the video is on my machine. Each time it fails, I take note of the video path and can guarantee that the path is always valid. The memory usage is also not increasing as the experiment continues. Perhaps the number of videos is the issue?

The trials loop goes through a CSV file with paths for the videos. The “trial” routine has a code component with the following “Begin Routine” section:
```js
movie_path = resources/${PID.toString().padStart(2, '0')}/${stimulus_filename};
repeat = true;
psychoJS._serverManager.prepareResources([{name: movie_path, path: movie_path}]).then((r)=>{
console.log(“ending routine”);
repeat=false;
});```
As you can see, the videos are dynamically loaded to avoid the overhead at the beginning of the experiment.

Here is the error:

That last request at the bottom never resolves.

I have also created a prototype in plain HTML and JS (without PsychoJS) that simply loads and plays each video in the CSV file, which works fine.

When I tried running the experiment online, something similar happened (worked for many videos and then suddenly failed). However, it failed with an error saying something like “source not found” (it’s been too long since trying it for me to remember, as I’ve been focusing on getting it to run locally).

Any help in this matter would be greatly appreciated as I’m starting to consider rolling my own site :sweat_smile:
Edit: just added the experiment file as I realized there’s nothing sensitive in it haha
Edit 2: welp, it worked when piloting it on Pavlovia, so the real question is why doesn’t it work locally?

test.psyexp (52.1 KB)