PennController for IBEX › Forums › Support › File Error Handling Behavior
- This topic has 4 replies, 2 voices, and was last updated 2 years, 1 month ago by dgetty.
April 16, 2021 at 1:41 pm #6870
I’m running a picture description task with auditory primes. The stimuli are pre-loading just fine for most people, but I’ve had one participant experience an issue where an audio file would not load. I’ve ruled out a filename error, so the only thing I can think of is that maybe their connection made it such that pre-loading went very slowly.
Since most of the other files loaded and played just fine, I’m wondering if there’s a way to add error handling behavior, where PCIbex will just skip an audio trial if it doesn’t load (e.g. maybe after 5 secs or so). I would also like to be able to write this error to the results file, so I know exactly where it occurred. Is something like this possible? Or is there a better way to handle this issue?
April 16, 2021 at 4:16 pm #6872JeremyKeymaster
- This topic was modified 2 years, 1 month ago by dgetty. Reason: typo
PennController should already report when a resource fails to preload in the results file: look for lines with “_PreloadFailed_” in them, they also report the name of the resource
You could run a Function element at the beginning of your trial and end it prematurely if the resource’s status is not “ready”:
newFunction( ()=>getAudio("file.wav")._element.resource.status ) .test.is("ready") .failure( end() )
"myAudio"with the name of your Audio element
Let me know if you have questions
JeremyApril 16, 2021 at 5:27 pm #6873
Thanks Jeremy! That’s working perfectly now.
Two quick follow up questions:
1) is there a way to shorten the length of the time that the pre-loading screen takes? I call CheckPreload() before the experimental trials begin, and I’m totally fine with that being a 60 second pause. But is there way for later pre-loading messages to only last for maybe 3-5 seconds before giving up and quitting on the current trial?
2) Is there some place I can read about/figure out tricks like the function you wrote in your previous response? For example, it never would have occurred to me to check “._element.resource.status”, and I don’t see that in the documentation anywhere. Just trying to learn to be more self-sufficient with these things.
-DougApril 16, 2021 at 6:41 pm #6874JeremyKeymaster
1) You can use
.setOption("preloadDelay", 5000)on the closing parenthesis of
2) These two tricks (
._element.resource.statusand 1 above) are actually pretty advanced, albeit concise. This is because it didn’t occur to me to make those things customizable. If you’re interested, you can take a look at PennController’s source code and try to hack it out 😉
JeremyApril 19, 2021 at 9:56 am #6875
Thanks, Jeremy! I may try to do that first next time 🙂
- You must be logged in to reply to this topic.