Audio not working online but is offline - "AudioContext was not allowed to start"

URL of experiment: IDED [PsychoPy]

Description of the problem: I want my experiment to play a ‘correct’ and ‘incorrect’ tone for accuracy feedback after each trial. These are saved as .wav files in the experiment folder. I currently have this working correctly in PsychoPy but can’t seem to get it to work online

Here is where I load the sounds

And then the task runs ding.play() when correct and beep.play() if incorrect

The error output from the online console is below, assuming its repeated as I have two audio files.

image

Not quite sure how to resolve this? Any help would be appreciated!

Thank you!

Chris

Hi @CDawes, it may be that you need to set the autoplay policy in Chrome. Enter chrome://flags/ in your browser window, and check the autoplay policy - this will only work in Chrome version > 61… See also this page.

If you cannot find the autoplay flag, then try and allow the website access via the site info button (the padlock next to the address bar. Click the padlock, go to Site Settings, and set audio to “allow”

Hi thanks for the quick reply.

I allowed audio in pavlovia and also the direct study link. I can’t see that warning anymore but a different error shows now - perhaps i’m not defining the path correctly? They’re both .wav files in the main folder of my experiment. How i’ve defined them works offline however.

image

Thanks again,

Chris

I see, since you have defined your sound objects in code, PsychoPy has not recognised the sound files as a resource. You will need to add copies of the wav files to the html/resources folder, resync and try again.

That did it! It also worked for my second experiment with the same issue.

Thank you so much!

1 Like