audio file not played #662
-
I got the following error message: The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu Things are all good if I change the audio file to a picture file and the corresponding "type: 'audio-keyboard-response'" to "type: 'html-keyboard-response'". Help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi,
if this doesn't work, you can add a dummy trial at the very beginning of the timeline that requires user interaction (I use html-button-response). On the console, it may still give this error but will play audios. This question was asked and answered many times in the discussion threads, you can type 'audio' in the search button to see other solutions. |
Beta Was this translation helpful? Give feedback.
Hi,
define a variable:
var audio_files = [
"silence.wav",
"noise.wav",
];
preload files:
jsPsych.init({
timeline: timeVar,
use_webaudio: false,
preload_audio: audio_files,
on_close: function() {...
...
});
if this doesn't work, you can add a dummy trial at the very beginning of the timeline that requires user interaction (I use html-button-response). On the console, it may still give this error but will play audios.
This question was asked and answered many times in the discussion threads, you can type 'audio' in the search button to see other solutions.