How to restrict the number of times participants can play audio | XM Community
Solved

How to restrict the number of times participants can play audio

  • 28 October 2018
  • 4 replies
  • 118 views

Hello all!
Does anyone know how to restrict the number of times participants can play audio attached to a question?
I would like my participants to hear each fragment only once. However, I do not want to remove the play button and let the sound autoplay, because they should have some time to read the question before they play the sound fragment.
I hope to hear from someone! Thanks in advance :)
Joy
icon

Best answer by emilym 29 October 2018, 17:59

View original

4 replies

Hello @joyhuijskens ,

Paste the following code in the js(onReady) of the question

jQuery('audio').on('ended', function() {
jQuery(this).css("pointer-events","none");
});
Hi Joy,

I'm working on a similar problem. You can also modify Shashi's code a bit to hide the media player instead of disabling clicking, which might be more comfortable for your users:
` jQuery('audio').on('ended', function()
{
jQuery(this).hide();
});
`
Thank you both for your replies! I will try to make this work:) Unfortunatly I am very inexperienced in programming - so I nee da little more information. Where exactly do I paste this in..? In the htmltext of each question.. and then in what line? Or where can i open the java script?
I am curious to hear from you!
> @joyhuijskens said:
> Thank you both for your replies! I will try to make this work:) Unfortunatly I am very inexperienced in programming - so I nee da little more information. Where exactly do I paste this in..? In the htmltext of each question.. and then in what line? Or where can i open the java script?
> I am curious to hear from you!

Follow this page to add the code in each page
Put in `OnReady` function

Leave a Reply