PennController for IBEX › Forums › Support › File Error Handling Behavior
- This topic has 4 replies, 2 voices, and was last updated 3 years, 5 months ago by dgetty.
-
AuthorPosts
-
April 16, 2021 at 1:41 pm #6870dgettyParticipant
Hi hi,
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?
Thanks!
-Doug
- This topic was modified 3 years, 5 months ago by dgetty. Reason: typo
April 16, 2021 at 4:16 pm #6872JeremyKeymasterHi Doug,
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() )
replace
"myAudio"
with the name of your Audio elementLet me know if you have questions
Jeremy
April 16, 2021 at 5:27 pm #6873dgettyParticipantThanks 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.
Thanks again!
-Doug
April 16, 2021 at 6:41 pm #6874JeremyKeymaster1) You can use
.setOption("preloadDelay", 5000)
on the closing parenthesis ofnewTrial
2) These two tricks (
._element.resource.status
and 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 😉Jeremy
April 19, 2021 at 9:56 am #6875dgettyParticipantThanks, Jeremy! I may try to do that first next time 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.