September 23, 2020 at 5:23 am #6160irenecgParticipant
I was wondering whether there is any way to request the loading of an element (an image, a video, an audio file) if it has failed in the preloading. Let me explain:
I am running an experiment that requires a lot of resources to be loaded from a server. For most of my participants this is not a problem, but some of them have poor internet connections. I took care of that reducing the size of the resources and splitting them into multiple small zip packages. However, what still happens is that sometimes their connection randomly drops part of the zip packages, thus resulting in not loading them, giving (sometimes, but not always) a PreloadFailed error in the script, and making the experiment fall.
I was wondering whether there could be any way to require the packages again if they have not been properly downloaded. For what I’ve understood from the debug window, PCIbex only tries to download them once.
My idea to fix it was to duplicate the packages to load (e.g. I have one called ‘videos’, I could create ‘videos2’) so to have extra insurance that, if the original has not been downloaded, maybe the copy will. But I’m afraid that, by doing it like that, I could make the program crash (since if everything would be downloaded, you’d have every resource duplicated).
Thank you a lot,
IreneSeptember 23, 2020 at 10:11 am #6161JeremyKeymaster
You are correct that currently PennController only tries to download the ZIP archives once. Duplicating packages seems the simplest way to go, and it shouldn’t make the program crash: it will just use whatever resource it finds first, so if two resources from two zip archives share the same filename, it won’t matter as long as they’re exact copies of each other.
Splitting your resources in multiple zip packages involves a subtle tradeoff, since the more packages you have, the more requests to the server, hence the more opportunities for a request to fail. Besides, some browsers (eg Safari) and some servers don’t like processing a high number of requests at once, so if you are requesting many zip archives this can also cause problems. Actually one of the arguments in favor of zipping your resources is to avoid a proliferation of requests for every single resource.
I’ll see if I can improve things on that front for future releases of PennController
JeremySeptember 28, 2020 at 11:47 am #6169irenecgParticipant
Thank you for your quick answer!
We’ll duplicate in that case.
- You must be logged in to reply to this topic.