jsPsych/examples/jspsych-single-audio.html
2017-06-09 23:29:16 -04:00

39 lines
938 B
HTML

<!DOCTYPE html>
<html>
<head>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-single-audio.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link>
</head>
<body></body>
<script>
/*
this demo will only work if run online or with special permissions enable offline
for chrome, launch the browser from the command-line:
chrome --allow-file-access-from-files
*/
var block_1 = {
type: 'single-audio',
trial_ends_after_audio: true,
timeline: [
{stimulus: 'sound/tone.mp3'},
{stimulus: function() { return 'sound/sound.mp3'; }},
{stimulus: 'sound/hammer.mp3'}
],
prompt: 'the trial should advance automatically after sound completes, or press any key to advance'
}
jsPsych.init({
timeline: [block_1],
preload_audio: ['sound/sound.mp3'],
on_finish: function() {jsPsych.data.displayData();}
});
</script>
</html>