mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
54 lines
1.6 KiB
HTML
54 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../jspsych.js"></script>
|
|
<script src="../plugins/jspsych-audio-button-response.js"></script>
|
|
<script src="../plugins/jspsych-html-button-response.js"></script>
|
|
<link rel="stylesheet" href="../css/jspsych.css">
|
|
</head>
|
|
<body></body>
|
|
<script>
|
|
|
|
var timeline = [];
|
|
|
|
timeline.push({
|
|
type: 'html-button-response',
|
|
stimulus: '<div style="max-width:600px;"><p>Some browsers now require the user to interact with a page before it can play audio. '+
|
|
'Clicking the button below counts as an interaction.</p><p>Be aware of this when planning audio experiments if '+
|
|
'you want the first trial to include audio.</p></div>',
|
|
choices: ['Continue']
|
|
});
|
|
|
|
timeline.push({
|
|
type: 'audio-button-response',
|
|
stimulus: 'sound/speech_green.mp3',
|
|
choices: ['Green', 'Blue', 'Red'],
|
|
prompt: "<p>What word was said?</p>"
|
|
});
|
|
|
|
timeline.push({
|
|
type: 'audio-button-response',
|
|
stimulus: 'sound/speech_red.mp3',
|
|
choices: ['Green', 'Blue', 'Red'],
|
|
trial_duration: 2000,
|
|
response_ends_trial: false,
|
|
prompt: "<p>What word was said? (trial ends after 2s)</p>"
|
|
});
|
|
|
|
timeline.push({
|
|
type: 'audio-button-response',
|
|
stimulus: 'sound/speech_joke.mp3',
|
|
choices: ['Not funny', 'Funny'],
|
|
prompt: '<p>How funny was the joke?</p><p>When the audio stops, click a button to end the trial.</p><p>Response buttons are disabled while the audio is playing.</p>',
|
|
response_allowed_while_playing: false
|
|
})
|
|
|
|
jsPsych.init({
|
|
timeline: timeline,
|
|
use_webaudio: false,
|
|
on_finish: function(){jsPsych.data.displayData();}
|
|
});
|
|
|
|
</script>
|
|
</html>
|