Check out the LimeSurvey source code on GitHub!

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

3 years 7 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 to join the conversation.

3 years 7 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 -

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 to join the conversation.

3 years 7 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 explaining how to implement it! :)



Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form