Welcome to the LimeSurvey Community Forum

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

Video with sound that can be only watched once

  • Jmantysalo
  • Jmantysalo's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
3 years 9 months ago #220055 by Jmantysalo
I should add a video to a survey, it should have sounds, and it should be possible to see only once. (Some kind of test or exam, got the request from a researcher.)

Of course there must be first some other page showing a video so that the user can set up volume level etc. Then, I can add a video by direct HTML code, <video autoplay muted>, and use timer to put some time limit to the [pseudo]question showing video. But autoplay only works if the video has no sound. So is there anything I can do, like some JS that would start timer when the user starts looking video?
 
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #220056 by Joffm
Hi,
maybe something like this.
Hide the "Next"-Button and at the end of the video show it again and trigger the "click"
Code:
<div class="embed-responsive embed-responsive-16by9"><video autoplay="autoplay" id="myvideo"><source src="https://www.myServer.de/myVideo.mp4" type="video/mp4" /> browser unterstützt dieses Format nicht.</video></div><script type="text/javascript" charset="utf-8">  $(document).ready(function() {    $('#ls-button-submit').hide();    var vid = document.getElementById("myvideo");    vid.volume = 0.3;    vid.onended = function() {      $('#ls-button-submit').show().trigger('click');    }});</script>
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #220058 by Joffm
Hm,
again the script
Code:
<div class="embed-responsive embed-responsive-16by9">
  <video autoplay="autoplay" id="myvideo"><source src="https://www.myServer.de/myVideo.mp4" type="video/mp4" /> browser unterstützt dieses Format nicht.</video>
</div>
 
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#ls-button-submit').hide();
    var vid = document.getElementById("myvideo");
    vid.volume = 0.3;
    vid.onended = function() {
      $('#ls-button-submit').show().trigger('click');
    }
  });
</script>

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • Jmantysalo
  • Jmantysalo's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
3 years 9 months ago #220130 by Jmantysalo
Replied by Jmantysalo on topic Video with sound that can be only watched once
Thanks, but at least on Firefox I can't get autoplay-option to work without muted-option. Otherwise nice solution!
The topic has been locked.
  • Jmantysalo
  • Jmantysalo's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
3 years 8 months ago #220131 by Jmantysalo
Replied by Jmantysalo on topic Video with sound that can be only watched once
Forget -- I can use just something like <p onClick=...play()>Start video</p>.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose