URL of experiment:
https://pavlovia.org/probert/deep_music_bhv_debug
https://gitlab.pavlovia.org/probert/deep_music_bhv_debug
Description of the problem:
Hello,
I’m having an issue with an online experiment that involves playing sounds (music pieces).
I have isolated the part that doesn’t work as intended, you can find it with the links above.
I have a trial routine that plays music pieces of variable length, a condition file with the file names and durations, and a loop that is supposed to play one piece at each iteration.
Everything is working properly during the first trial, but I don’t have sound for the following trials.
Some additional info :
- I use the builder v2023.1.1 with some added JS code, and I test everything on pavlovia directly.
- the duration is retrieved correctly.
Duration values are always 0.5 sec more that the .mp3 durations, to make sure that the sound is not cut before the end. I have also added another 1 sec to the trial duration, just in case. - the file_name is also retrieved correctly.
- the
music.play()
andmusic.stop()
seem to be accessed properly - the
music.status
is correctly set at STARTED or FINISHED, during and at the end of a trial - I tested it on chrome & firefox, and on two computers, and I have the same issue
- I have tried many workarounds (like setting
music.stop()
from custom code if t > duration), without success
The only clue that I have is this warning : “An AudioContext could not start automatically. It must be created or resumed after a user gesture on the page.”
I got it when testing on a second computer (and with chrome), but I don’t know what to do about it.
Any help would be greatly appreciated !