I would like to present an audio clip (wav format, stored in my personal Files Library on Qualtrics) that plays immediately upon loading the page, and then have the page automatically advance after an additional delay of 500 milliseconds. I have been using the following code, but there are two problems: one is that the audio clip will play multiple times overlapping with itself, and two is that the survey will advance too early. Any help would be appreciated.
Here is the code I'm using, in the addOnReady() portion of the Javascript:
const audio = new Audio("LINK_TO_AUDIO_CLIP");
audio.play();
var delay_length = (audio.duration * 1000) + 500; //duration is given in seconds, convert to ms
setTimeout(function () {
jQuery("#NextButton").click();
}, delay_length);
Auto advance page after playing audio clip with added delay
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
