This commit is contained in:
Josh de Leeuw 2020-12-03 14:04:40 -05:00
commit 66b1af85b6

View File

@ -2405,16 +2405,6 @@ jsPsych.pluginAPI = (function() {
}
audio.removeEventListener('error', handleError);
});
audio.addEventListener('stalled', function handleStalled(){
if(count < jsPsych.initSettings().max_preload_attempts){
setTimeout(function(){
load_audio_file_html5audio(source, count+1)
}, 200);
} else {
jsPsych.loadFail();
}
audio.removeEventListener('stalled', handleStalled);
});
audio.addEventListener('abort', function handleAbort(){
if(count < jsPsych.initSettings().max_preload_attempts){
setTimeout(function(){
@ -2618,7 +2608,10 @@ jsPsych.pluginAPI = (function() {
loaded++;
if(progress_bar){
var percent_loaded = (loaded/total_n)*100;
jsPsych.getDisplayElement().querySelector('#jspsych-loading-progress-bar').style.width = percent_loaded+"%";
var preload_progress_bar = jsPsych.getDisplayElement().querySelector('#jspsych-loading-progress-bar');
if (preload_progress_bar !== null) {
preload_progress_bar.style.width = percent_loaded+"%";
}
}
}