Hello!
Is it possible to make sure the audio file that I've placed in my survey can only be listened to once? I need to make sure that each respondent can only listen to the audio file once. I was considering using autoplay, but the respondent needs to read the question before listening to the audio file so they need to be able to play it when they're ready.
I'm an extreme novice when it comes to coding so any help would be greatly appreciated!
Thanks!
Yes, this is possible. please use the below code in addOnload function, it will be based on your audio element id.
var audioPlayer = document.getElementById("audi_player");
audioPlayer.load();
audioPlayer.play();
audioPlayer.loop = false;
Your audio file in question text,
SurajK Thank you so much for your response! By any chance would you be able to help me customize the code for my specific mp3 file? When I upload the file this is the html code:
Sorry for the trouble, I'm extremely new to javascript and have absolutely no clue where to begin!
Have you tried the below code,
Have used your audio file url and add below code in JS,
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var audioPlayer = document.getElementById("audi_player");
audioPlayer.load();
audioPlayer.play();
audioPlayer.loop = false;
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.