Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Triggering launch of questions when video is paused

More
2 months 5 days ago #239660 by JenniWatson
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi, I am trying to create a survey where participants view a video and make comments as they go along, ideally they would watch the video and then at relevant points to them they can stop the video and this will trigger a set series of questions. Is this possible?

Please Log in to join the conversation.

More
2 months 5 days ago #239661 by tpartner
Use JavaScript pause event for an HTML video element to trigger showing question(s)

- www.w3schools.com/tags/av_event_pause.asp

So, for example, some HTML like this in the source of a text-display question:

Code:
<div class="video-wrapper">
   <video id="myVideo" width="320" height="240" controls>
      <source src="path/to/your/video.mp4" type="video/mp4">
      Your browser does not support the video tag.
  </video>
</div>

And, this script (using jQuery) also in that question source:

Code:
<script type="text/javascript" data-author="Tony Partner">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
     
    // Hide all other questions
    $('.question-container').not(thisQuestion).hide();
 
    // Listener on the video
    $('#myVideo').on('pause', function(e) {
      $('.question-container').not(thisQuestion).fadeIn(500);
    });
  });
</script>

Sample survey for LS 5.x attached:  

File Attachment:

File Name: limesurvey...9551.lss
File Size:45 KB

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 months 2 days ago #239737 by JenniWatson
Many thanks, I think that’s a bit beyond my level of skill but I appreciate your advice!

Please Log in to join the conversation.

More
2 months 2 days ago #239740 by holch
It is all provided by Tpartner, he even attached an example survey (LSS) that you can import and see for your self.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

More
2 months 2 days ago #239741 by JenniWatson
I think my total beginner status is tripping me up - when I tried to use the example survey nothing played at all.
I have spent hours on the forum etc but can’t get it to work, I have tried to work around with if statement etc but still stuck.

Please Log in to join the conversation.

More
2 months 2 days ago #239743 by holch
Where is your LS hosted? If it is a university or big organisation, there is a good chance that the XSS filter is on and the Javascript required for Tpartner's solution is most probably filtered out.

Therefore, it is very important to that when you ask about things like that, to mention the LS Version you are using, the Theme/Template as well as where it is hosted.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose