Forcing participants to listen to a sound file before answering the question | XM Community
Skip to main content

I am trying to make a questionnaire in which participants have to listen to a audio piece and then choose one of the two multiple choice questions. I want to have the audio file and the answer options on the same page. But my problem is, I want the participants to be forced to play the audio file before answering to avoid people answering without listening. For example that the answer options grey out before listening. 

 

Is this something I can do? I can’t figure it out. Can you please help me? 

@iris1200

This can be done via custom coding; you can disable the option choices of question and Next button unless audio is ended. 

The following discussion should help Hiding the mutliple choice answers until sounds is played | XM Community (qualtrics.com)

Following page from stack overflow should help you in coding: javascript - How to detect an audio has finished playing in a web page? - Stack Overflow

Hope it helps!


Aside from custom coding, one thing that you can do is utilize the feature DELAY SHOWING SUBMIT BUTTON. It wouldn’t guarantee a participant engages with the audio, but it certainly would encourage them to play the clip and prevent them from moving on until at least the length of the clip. 

Good luck!


@Deepak  @SeanS  Thank you very much for the fast answers. I figured that I want to do it in a bit different way because this way can influence the ‘flow’ of participants filing in the questionnaire. 

 

I stumbled across this topic: 

 

I implemented the code and it works in the way that I get extra columns for every ‘played’ column that I add (I added played1, played2, etc for all questions). 

 

But all my results say ‘no’ , even if I played the audio, so played;yes is not overruling the standard value of the embedded data. Im not so good at explaining this but do you have any idea how I could get this to work? 


@Deepak  @SeanS  Thank you very much for the fast answers. I figured that I want to do it in a bit different way because this way can influence the ‘flow’ of participants filing in the questionnaire. 

 

I stumbled across this topic: 

 

I implemented the code and it works in the way that I get extra columns for every ‘played’ column that I add (I added played1, played2, etc for all questions). 

 

But all my results say ‘no’ , even if I played the audio, so played;yes is not overruling the standard value of the embedded data. Im not so good at explaining this but do you have any idea how I could get this to work? 

If you have hardcoded No(presuming), the custom code would not override and punch yes. I recommend keeping it blank and then checking the same.

Also, kindly make updates in code to played1, played2 wherever you would like to push the data from.

Hope it helps!


Thank you for your response again @Deepak 

I now changed the embedded data value to empty

 

And I tried again with playing the first one and not the second and third one. 

My output is this;

Which is not what I did, I’m not sure how. And how can the program tell to put in no? because I just deleted that as a value. Im really struggling and have to put out the survey today.

 

 

Also, what do you mean with “Also, kindly make updates in code to played1, played2 wherever you would like to push the data from.” ? I do not understand.

 

 

 


Thank you for your response again @Deepak 

I now changed the embedded data value to empty

 

And I tried again with playing the first one and not the second and third one. 

My output is this;

Which is not what I did, I’m not sure how. And how can the program tell to put in no? because I just deleted that as a value. Im really struggling and have to put out the survey today.

 

 

Also, what do you mean with “Also, kindly make updates in code to played1, played2 wherever you would like to push the data from.” ? I do not understand.

 

 

 

Can you paste your code here?

Also,have you published the survey and tried?

Lastly by updating I mean with 3 embedded datas there would be 3 javascript each for a different audio so are you calling that specific audio on your javascript call while pushing yes or no in embedded datas.


@Deepak 

Ive tried a few things and now the played , played1 and played2 columns stay completely empty. 

This is the code: 

Qualtrics.SurveyEngine.addOnload(function()
{
    /*Place your JavaScript here to run when the page loads*/
jQuery('qmedia').on('play', function() { 
Qualtrics.SurveyEngine.setEmbeddedData('played', 'yes');
});    
});

Qualtrics.SurveyEngine.addOnReady(function()
{
    /*Place your JavaScript here to run when the page is fully displayed*/

});    


    
Qualtrics.SurveyEngine.addOnUnload(function()
{
    /*Place your JavaScript here to run when the page is unloaded*/

});

 

 

 

 

And ofcourse where (‘played’, ‘yes’) stands I changed that to played1 and played 2. I have three questions to try and get to work before I do the rest. 

 

Ofcourse I tested, I tested about 40 times and changing multiple things but I just dont get it to work. 


@Deepak

Ive tried a few things and now the played , played1 and played2 columns stay completely empty. 

This is the code: 

Qualtrics.SurveyEngine.addOnload(function()
{
    /*Place your JavaScript here to run when the page loads*/
jQuery('qmedia').on('play', function() { 
Qualtrics.SurveyEngine.setEmbeddedData('played', 'yes');
});    
});

Qualtrics.SurveyEngine.addOnReady(function()
{
    /*Place your JavaScript here to run when the page is fully displayed*/

});    


    
Qualtrics.SurveyEngine.addOnUnload(function()
{
    /*Place your JavaScript here to run when the page is unloaded*/

});

 

 

 

 

And ofcourse where (‘played’, ‘yes’) stands I changed that to played1 and played 2. I have three questions to try and get to work before I do the rest. 

 

Ofcourse I tested, I tested about 40 times and changing multiple things but I just dont get it to work. 

@iris1200 

Change ‘qmedia’ to ‘audio’ in your code and it should work. 

Also, if you have multiple audios on single page you can use below function for first and change eq value for the rest.

jQuery('audio').eq(0).on('play', function(){

});

Hope it helps!


@Deepak Thank you. It worked for the first question! the  ‘played’ embedded data got filled in correctly. But I played all three and the second and third one didnt work. 

The code of the second question is:


Qualtrics.SurveyEngine.addOnload(function()
{
jQuery('audio').on('play', function() { 
Qualtrics.SurveyEngine.setEmbeddedData('played1', 'yes');
});    
});

 

 

Which is exactly the same but I added a 1 and for the third question I added a 2. These are also in my embedded data. I dont understand why played works, but played1 and played2 dont? 


I have 1 audio per page btw


@iris1200 

Not sure, where you are facing the issue as it works on my end. Also, if you just drag the audio and not hit the play button the code wouldn’t execute. 

Try checking it on console if the code is getting called or if it’s stuck somewhere.

Hope it helps!


@Deepak thanks. I have no idea, it very weird. I tried checking with console and this is what is says. Not sure what it means

 

 


Thank you very much for your help though. I really appreciate it. In a few hours I will work on it again and Im thinking about starting my questionnaire over from scratch. Maybe then it will work. 


Thank you very much for your help though. I really appreciate it. In a few hours I will work on it again and Im thinking about starting my questionnaire over from scratch. Maybe then it will work. 

The error you see on console is unrelated to the audio JS. Apparently my next suggestion would have been to start from scratch only.

 


@Deepak 

I made a new survey and it worked!!! So happy. Thank you so much for your help, really appreciate it. Thankyou!


Leave a Reply