Embedding audio in questions: limiting number of times audio clip can be heard

5 years 9 months ago #96479 by StuTheQ
Hello everybody,

Let's imagine that I have an audio clip that I want the respondent to listen to.

I begin by embedding the following code (basic example copied from the 'Embedding audio in questions' workaround in the 'Workarounds: Question design, layout and templating' section of the manual) in the question text itself:
<embed height="20" width="128" autostart="false" controls="console"
loop="true" volume="50" src="{TEMPLATEURL}audio_1.mp3"></embed>

Is there then a way of limiting the number of times that the respondent can listen to the audio clip? (twice only, for example)

In addition, the respondent should ideally not be able to 'pause' or 'rewind' the audio clip once it has started playing (I'm not asking for much here!! :) )

Thank you all very much in advance!



Please Log in or Create an account to join the conversation.

LimeSurvey Partners
5 years 9 months ago #96487 by tpartner
You won't be able to achieve that with a plain <embed> element but you should be able to do it if you use a plugin like jPlayer to serve the audio files - www.limesurvey.org/en/forum/can-i-do-thi...reaming-advice#94628

You can use the jPlayer "ended" event to increment a counter and destroy the player after two loops.

Preventing pause or rewind would simply be a matter of removing those controls from the jPlayer skin .

Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: StuTheQ

Please Log in or Create an account to join the conversation.

5 years 9 months ago #96503 by StuTheQ
Dear Tony,

Thank you once again for replying to my query.

In fact, after further research/reading concerning this topic, I was about to delete my my post. From what I've now discovered, it seems that embedding audio is not a LimeSurvey functionality as such, but more an HTML or plugin question... :whistle:

I also saw that, as you said, it's quite straightforward to add or remove controls to/from the 'console'.

Flowplayer had caught my eye but I'll definitely check out jPlayer, all the more so given that that there is your post www.limesurvey.org/en/forum/can-i-do-thi...reaming-advice#94628 explaining how to implement it! :)



Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!