jsPsych/examples/jspsych-single-audio.html
2016-12-09 21:25:56 -05:00

38 lines
850 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>
<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',
timeline: [
{stimulus: function() { return 'sound/sound.mp3'; }},
{stimulus: 'sound/hammer.mp3'}
],
prompt: 'press any key to advance'
}
jsPsych.pluginAPI.preloadAudioFiles(['sound/sound.mp3'], start);
function start(){
jsPsych.init({
timeline: [block_1],
on_finish: function() {jsPsych.data.displayData();}
});
}
</script>
</html>