Solved
Randomize mp3 between blocks
Hi all
I have a questionnaire with 4 blocks with 3 questions in each block.
The 2nd question in each block should contain 1 out of 4 mp3 audio.
I wish to be able to randomize only the mp3 audio between the blocks in a way that each mp3 file will be played only once.
(unfortunately randomizing the blocks doesn't work for me)
Any suggestions?
Thanks in advance,
Ran
Best answer by Anonymous
Hello @Ran ,
Assuming you have added audio using HTML audio tag
Please follow the below steps:
Step 1: Create 4 embedded data ( A1, A2, A3, A4 ) as the first element of the survey flow.
Step 2: Paste the attached code in the js(onReady) of the first question of the survey ( assuming first question is not the block question and is on separate page )
Step 3: In second question of each block replace scr attribute value of audio tag with embedded data as shown in below code
<audio controls>
<source src="${e://Field/A1}" type="audio/ogg">
Your browser does not support the audio element.
</audio>
Similarly for all second question with changed embedded data(A2, A3, A4)
Explanation: In JS code replace the AudioSrc1 with the source of first audio tag and similarly for other three. The js randomizes the array and assign random values to embedded data. Hence we see random audio in question two
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

Now just pipe _Block File (1,2,3,4)_ to the appropriate blocks.