One piece of audio playing uniterrupted across several questions

More
2 weeks 2 days ago #228286 by paul.emmines
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.3.13
Own server or LimeSurvey hosting: LS
Survey theme/template: Bootwatch
==================
I want to be able to get responses on a piece of audio, with an opening question and then a number of conditional questions.  I would like the audio clip to play throughout the opening Q and the subsequent Qs without interruption. 

I tried putting my audio player into the Question Group (as each piece of audio will be a Group) description rather than the individual Qs - but it doesn't then appear anywhere in the questions (I'm presenting Q by Q.)

If I could swap the question text on my questions in each group for the question group description, would that work (and how would I do it with js?)  Or is there another solution?
 

Please Log in to join the conversation.

More
2 weeks 2 days ago - 2 weeks 2 days ago #228293 by holch
It won't work, because with each click on "next" a new "page" is called and this would interrupt anything that was happening on the previous "page". I don't really see how this could possibly work in question by question mode.

I don't even think it would work with Javascript uninteruptetly.

It is like in real life: If you leave one concert hall to go to the next concert hall, you won't be able to hear the music from concert hall 1 on the way to concert hall 2 or at concert hall 2. Only if you carry an iPod or something and listen to your own music. ;-)

I don't want to completely exclude that there is some possibility via Javascript or an Iframe or something. But I currently don't see how this might work.

The only option that I really see is to go for "group by group" and then show/hide the questions via Javascript one after the other or something.

Maybe Tpartner has an idea.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Last edit: 2 weeks 2 days ago by holch.

Please Log in to join the conversation.

More
2 weeks 2 days ago #228302 by tpartner
That is exactly what you will need to do. Use group-by-group mode and show sequential questions via JavaScript. It gets a little complex if you allow backwards navigation or have conditional questions.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
2 weeks 2 days ago #228319 by paul.emmines
That all makes sense. So... I have a bunch of conditional Qs. The survey is now displaying by group (but I only see the first Q as the others are conditional.) The question text itself is the same for all the Qs, so I've hidden that and replaced it with the Group Description (which gives me the audio player.)

What would the js look like in this example:

Question 1 (code Q1) is answered with answer 1 (code A1) which then needs to submit that result, and bring up the conditional Q answers (code Q2.) When Q2 is answered with answer code A6, the answer needs to be submitted and the group is then completed.

Please Log in to join the conversation.

More
2 weeks 2 days ago #228322 by tpartner
Can you attach a small sample survey (.lss file) containing only a small sample group?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
2 weeks 1 day ago #228351 by paul.emmines
Attached here.

So what I'm doing is asking people to identify the genres of the music - one initial question for the bigger genres, then digging down into the individual genres for the conditional follow up Qs.  The player is housed in the group description - currently just HTML5 but planning on replacing with a js player.  I'm using CSS to hide the actual Q text and replace it with the group description now that I've switched from presenting by question, to presenting by group.

I've removed the SUBMIT button (with your help!) so that clicking the answer takes you to the next question, or completes the group.

What I need is to be able to make the presentation by group "feel like" question-by-question presentation, so that the player in the Group Description plays continuously through all the questions in that group.

 
Attachments:

Please Log in to join the conversation.

More
2 weeks 1 day ago - 2 weeks 1 day ago #228368 by tpartner
I'll try to have a look but I'm on vacation for two weeks so limited access to my server.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 2 weeks 1 day ago by tpartner.

Please Log in to join the conversation.

More
2 weeks 20 hours ago #228390 by Joffm
Hi,
there was still this "trigger('click')" in the first question. So after this the sound starts again.

Here a solution, which - I am sure - will beimproved by Tony.

1. Add a css class "hidden" to all second questions.
2. Insert this in the source code of the first question.
<script type="text/javascript">    
    $(document).on('ready pjax:scriptcomplete',function(){
 
        // Hide the submit button
        $('#ls-button-submit').hide();
 
        // Listener on the (hidden) radio inputs 
        $('#question{QID} :radio').on('change', function(e) {
           $('#question{QID}').hide();
 
// Here you have to adapt the questionIDs of your survey
           $('#question5684').removeClass('hidden');
           $('#question5685').removeClass('hidden');
           $('#question5686').removeClass('hidden');
           $('#question5687').removeClass('hidden');
        });
    });
</script>

Now, at the start only the first question is visible.
After the click the first question is hidden, but all second questions get visible.
Because of the condition only the relevant is displayed.

The disadvantage that has to be improved: the questionID of the second questions is hard coded.

Some last remarks:
What means <brk>?
If you set the "maximum numbers of buttons in a row" to "1" you don't need to set the width to 100%
Better to hide the asterisk in the "custom.css" of an extended theme


Joffm
 


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
1 week 5 days ago #228441 by paul.emmines
That's amazing! Thank you for the help. (I've also tidied up the CSS as you suggested!)

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now