Repeating Stimuli not working with javascript/local browser

I have a routine that presents an image and some audio. The participant presses “1” for yes, “0” for no, or “space” to repeat the audio. I’ve done this in the desktop version by using a code component with the following code at the end of the routine.

if key_resp_2.keys == '1' or key_resp_2.keys == '0': 
    trial_repeat.finished = True

Everything works fine in the desktop version, but in the javascript version of the experiment run in my browser nothing happens when I press space. There are no errors in the JS console either.

Any thoughts on what might be the issue?



if ‘1’ in key_resp_2.keys or ‘0’ in key_resp_2.keys:
    trial_repeat.finished = True

I think that you are saving all keys so .keys is a list not a string.

Ok I tried that and it didn’t work. I have the same issue.

I can tell the conditional is being entered into (I printed something to the console). It just seems like the audio is not playing

Also, I checked that I am saving the last key

Ok I found the issue. It seems like a bug with PsychoJS. The audio only repeats when the audio component starts with a small delay. I’ve attached a small experiment to highlight the issue. (5.2 MB)