Preloading 300 audio files - experiment crashes for participants #739
-
Hi, I have a question about preloading audio. One of our experiments preloads about 300 audio files and presents a total of 480 audio files throughout the entire experiment. We found that the loading bar at the beginning of the experiment either goes to completion but says "the experiment fails to load" or the loading bar doesn't load at all and then it says "the experiment fails to load" for some people. While the experiment works perfectly for others. The browsers that worked most of the time were firefox and chrome (for chrome, some people said they had to refresh the experiment multiple times before it worked properly though), while microsoft edge and safari didn't seem to work for any of the participants! I was wondering if there was another method or any suggestions on how to better preload a large amount of audio files? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
There's a timeout parameter in jsPsych.init({
...
max_load_time: 120000 //120 seconds
}) It's weird that this is browser specific. It could be the case the Edge and Safari have a stricter limit on how many files can be preloaded into the browser cache. If you try loading it with Edge or Safari do you get any specific error messages in the console? Is it possible to load fewer files at a time with your experiment design? For example, this discussion gives a method for loading files in chunks. |
Beta Was this translation helpful? Give feedback.
-
I think maybe the audio preload function expects an array, even if it's just one file. What happens if you put the stimulus from the timeline variables inside square brackets?
Becky
|
Beta Was this translation helpful? Give feedback.
-
Sorry, I meant adding square brackets around your audio file(s) in the preload function, like this: jsPsych.pluginAPI.preloadAudioFiles([jsPsych.timelineVariable('stimulus', true)], function () {
done({ preload: "success" });
}) The reason I'm suggesting this is that the docs for the preloadAudioFiles function say that the first argument should be an array, whereas your stimulus variable is a string. Also, I can see from your console errors that jsPsych is trying to load a set of files, where each file is a letter from your stimulus path ('s, 'h', 'a', etc.). This suggests to me that you've given the preload function a string, and the function is trying to treat that string as an array, so you end up with an array of individual characters. |
Beta Was this translation helpful? Give feedback.
Sorry, I meant adding square brackets around your audio file(s) in the preload function, like this:
The reason I'm suggesting this is that the docs for the preloadAudioFiles function say that the first argument should be an array, whereas your stimulus variable is a string. Also, I can see from your console errors that jsPsych is trying to load a set of files, where each file is a letter from your stimulus path ('s, 'h', 'a', etc.). This suggests to me that you've given the preload function a string, and the function is trying to treat that string as an arra…