mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
fix bug for html5 audio use in single-audio
This commit is contained in:
parent
0917379d9e
commit
bf80a689d4
@ -20,10 +20,11 @@
|
||||
type: 'single-audio',
|
||||
trial_ends_after_audio: true,
|
||||
timeline: [
|
||||
{stimulus: 'sound/tone.mp3'},
|
||||
{stimulus: function() { return 'sound/sound.mp3'; }},
|
||||
{stimulus: 'sound/hammer.mp3'}
|
||||
],
|
||||
prompt: 'press any key to advance'
|
||||
prompt: 'the trial should advance automatically after sound completes, or press any key to advance'
|
||||
}
|
||||
|
||||
jsPsych.init({
|
||||
|
BIN
examples/sound/tone.mp3
Normal file
BIN
examples/sound/tone.mp3
Normal file
Binary file not shown.
@ -90,7 +90,7 @@ jsPsych.plugins["single-audio"] = (function() {
|
||||
end_trial();
|
||||
}
|
||||
} else {
|
||||
audio.addEventListener('end', end_trial);
|
||||
audio.addEventListener('ended', function(){ end_trial(); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ jsPsych.plugins["single-audio"] = (function() {
|
||||
source.onended = function() { }
|
||||
} else {
|
||||
audio.pause();
|
||||
audio.removeEventListener('end', end_trial);
|
||||
audio.removeEventListener('ended', end_trial);
|
||||
}
|
||||
|
||||
// kill keyboard listeners
|
||||
|
Loading…
Reference in New Issue
Block a user