jsPsych
jsPsych copied to clipboard
"AudioContext was not allowed to start" warning, but not using any audio-related plugins
Receiving the following warning in Google Chrome (129.0.6668.70) web inspector:
MediaAPI.ts:19 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
I understand the error occurs because browsers require interaction before allowing audio to play. However, I can recreate the issue in a barebones experiment with no audio-related plugins, just a simple html-keyboard-response.
JavaScript:
let jsPsych = initJsPsych();
let timeline = [];
let welcomeTrial = {
type: jsPsychHtmlKeyboardResponse,
stimulus: `
<h1>Welcome to the Lexical Decision Task!</h1>
<p>In this experiment, you will be shown a series of characters and asked to categorize whether the characters make up a word or not.</p>
<p>There are three parts to this experiment.</p>
<p>Press SPACE to begin the first part.</p>
`,
choices: [' ']
};
timeline.push(welcomeTrial);
jsPsych.run(timeline);
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Lexical Decision Task</title>
<link href=data:, rel=icon>
<link href='https://unpkg.com/jspsych/css/jspsych.css' rel='stylesheet' type='text/css'>
<script src='https://unpkg.com/jspsych'></script>
<script src='https://unpkg.com/@jspsych/plugin-html-keyboard-response'></script>
<script src='experiment.js'></script>
</head>
<body></body>
</html>