mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-11 16:18:11 +00:00
remove HTML5 stalled event listener & check for progress bar before updating - fixes #1262
This commit is contained in:
parent
6bcb624f7d
commit
7cd7fc65f4
15
jspsych.js
15
jspsych.js
@ -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+"%";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user