This commit is contained in:
Josh de Leeuw 2018-06-25 15:39:40 -04:00
parent 0f92127a49
commit 176424df82
3 changed files with 30 additions and 2 deletions

View File

@ -3,6 +3,7 @@
<head> <head>
<script src="../jspsych.js"></script> <script src="../jspsych.js"></script>
<script src="../plugins/jspsych-audio-button-response.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"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body></body> <body></body>
@ -10,6 +11,14 @@
var timeline = []; var timeline = [];
timeline.push({
type: 'html-button-response',
stimulus: 'Recent versions of Chrome require the user to interact with a page before it can play audio. '+
'Clicking the button below counts as an interaction. Be aware of this when planning audio experiments if '+
'you want the first trial to include audio.',
choices: ['Continue']
});
timeline.push({ timeline.push({
type: 'audio-button-response', type: 'audio-button-response',
stimulus: 'sound/speech_green.mp3', stimulus: 'sound/speech_green.mp3',

View File

@ -3,10 +3,20 @@
<head> <head>
<script src="../jspsych.js"></script> <script src="../jspsych.js"></script>
<script src="../plugins/jspsych-audio-keyboard-response.js"></script> <script src="../plugins/jspsych-audio-keyboard-response.js"></script>
<script src="../plugins/jspsych-html-button-response.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body></body> <body></body>
<script> <script>
var pre_audio = {
type: 'html-button-response',
stimulus: 'Recent versions of Chrome require the user to interact with a page before it can play audio. '+
'Clicking the button below counts as an interaction. Be aware of this when planning audio experiments if '+
'you want the first trial to include audio.',
choices: ['Continue']
}
var trial_1 = { var trial_1 = {
type: 'audio-keyboard-response', type: 'audio-keyboard-response',
stimulus: 'sound/speech_blue.mp3', stimulus: 'sound/speech_blue.mp3',
@ -31,7 +41,7 @@
} }
jsPsych.init({ jsPsych.init({
timeline: [trial_1, trial_2, trial_3], timeline: [pre_audio, trial_1, trial_2, trial_3],
use_webaudio: false, use_webaudio: false,
on_finish: function() { on_finish: function() {
jsPsych.data.displayData(); jsPsych.data.displayData();

View File

@ -3,11 +3,20 @@
<head> <head>
<script src="../jspsych.js"></script> <script src="../jspsych.js"></script>
<script src="../plugins/jspsych-audio-slider-response.js"></script> <script src="../plugins/jspsych-audio-slider-response.js"></script>
<script src="../plugins/jspsych-html-button-response.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link> <link rel="stylesheet" href="../css/jspsych.css"></link>
</head> </head>
<body></body> <body></body>
<script> <script>
var pre_audio = {
type: 'html-button-response',
stimulus: 'Recent versions of Chrome require the user to interact with a page before it can play audio. '+
'Clicking the button below counts as an interaction. Be aware of this when planning audio experiments if '+
'you want the first trial to include audio.',
choices: ['Continue']
}
var trial_1 = { var trial_1 = {
type: 'audio-slider-response', type: 'audio-slider-response',
stimulus: 'sound/speech_joke.mp3', stimulus: 'sound/speech_joke.mp3',
@ -16,7 +25,7 @@
} }
jsPsych.init({ jsPsych.init({
timeline: [trial_1], timeline: [pre_audio, trial_1],
use_webaudio: false, use_webaudio: false,
on_finish: function() { on_finish: function() {
jsPsych.data.displayData(); jsPsych.data.displayData();