- Posts: 64
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
hide movenext button until video has been fully played
- Andrea01
- Topic Author
- Offline
- Senior Member
Less
More
8 years 2 months ago #131445
by Andrea01
hide movenext button until video has been fully played was created by Andrea01
Hi,
in the answerfield I Show a Video like this:
<a href="#" onclick="$('#video').show(); $(this).hide();">Click to Play the video!</a>
<div id="video">
<video autoplay="" height="500" id="video1" src="myvideo>
</video>
</div>
<script>
$('#video').hide();
</script>
How can I hide or disable the "movenext button" until the Video has been fully played.
Thanks in advance
Andrea
in the answerfield I Show a Video like this:
<a href="#" onclick="$('#video').show(); $(this).hide();">Click to Play the video!</a>
<div id="video">
<video autoplay="" height="500" id="video1" src="myvideo>
</video>
</div>
<script>
$('#video').hide();
</script>
How can I hide or disable the "movenext button" until the Video has been fully played.
Thanks in advance
Andrea
The topic has been locked.
- david2013
- Offline
- Senior Member
Less
More
- Posts: 42
- Thank you received: 6
8 years 2 months ago #131447
by david2013
Replied by david2013 on topic hide movenext button until video has been fully played
I use media element (
mediaelementjs.com/
). It has video end event.
The topic has been locked.
- Andrea01
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 64
- Thank you received: 0
8 years 2 months ago #131466
by Andrea01
Replied by Andrea01 on topic hide movenext button until video has been fully played
Thank you. Is there no other solution?
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11645
- Thank you received: 2738
8 years 2 months ago #131468
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic hide movenext button until video has been fully played
You are basically using the HTML5 element for video, which means respondents need a browser that supports this element. How do you guarantee this?
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- Andrea01
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 64
- Thank you received: 0
8 years 2 months ago #131498
by Andrea01
Replied by Andrea01 on topic hide movenext button until video has been fully played
@ Holch: We show a video at the beginning of the questionnaire, asking the respondents what they see and what they hear.
They can move on to the next question only when their answers are correct.
@david2013: Thank you , I will try mediaelements.
And hopefully I can adress the movenext button with mediaelements.
I am able to adress an external button with this code.
But I did not succeed to adress the limesurvey movenext button.
<video id="myvideo" autoplay>
<source src="myvideo" type="video/mp4">
browser unterstützt dieses Format nicht.
</video>
<button id="playbtn">Weiter</button><br />
<script>
var vid = document.getElementById("myvideo");
document.getElementById('playbtn').style.visibility = 'hidden'
vid.onended = function() {
document.getElementById('playbtn').style.visibility = 'hidden'
document.getElementById('playbtn').style.visibility = 'visible'
};
best regards
Andrea
They can move on to the next question only when their answers are correct.
@david2013: Thank you , I will try mediaelements.
And hopefully I can adress the movenext button with mediaelements.
I am able to adress an external button with this code.
But I did not succeed to adress the limesurvey movenext button.
<video id="myvideo" autoplay>
<source src="myvideo" type="video/mp4">
browser unterstützt dieses Format nicht.
</video>
<button id="playbtn">Weiter</button><br />
<script>
var vid = document.getElementById("myvideo");
document.getElementById('playbtn').style.visibility = 'hidden'
vid.onended = function() {
document.getElementById('playbtn').style.visibility = 'hidden'
document.getElementById('playbtn').style.visibility = 'visible'
};
best regards
Andrea
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
8 years 2 months ago - 8 years 2 months ago #131514
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic hide movenext button until video has been fully played
As Holch points out, the video element and the onended event will only work in browsers that support HTML5.
Having said that, try something like this:
Having said that, try something like this:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Hide the "Next" button $('#movenextbtn').hide(); var vid = document.getElementById("myvideo"); vid.onended = function() { // Show the "Next" button $('#movenextbtn').show(); } }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 2 months ago by tpartner.
The topic has been locked.
- Andrea01
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 64
- Thank you received: 0
8 years 2 months ago #131522
by Andrea01
Replied by Andrea01 on topic hide movenext button until video has been fully played
Hi Tony
thanks a lot, works perfectly
Andrea
thanks a lot, works perfectly
Andrea
The topic has been locked.
- Andrea01
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 64
- Thank you received: 0
8 years 2 months ago #131704
by Andrea01
Replied by Andrea01 on topic hide movenext button until video has been fully played
Hi everybody,,
I finally have installed mediaelements.js by including the scripts in the head of my template (trf_resonsive).
But the Problem is that I can't hide the limesurey movenext button, even tough I put following code:
<script>
(document).ready(function() {
$('#movenextbtn').hide();
});
</script>
Any idea?
Thanks in advance
Andrea
</script>
I finally have installed mediaelements.js by including the scripts in the head of my template (trf_resonsive).
But the Problem is that I can't hide the limesurey movenext button, even tough I put following code:
<script>
(document).ready(function() {
$('#movenextbtn').hide();
});
</script>
Any idea?
Thanks in advance
Andrea
</script>
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
8 years 2 months ago #131706
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic hide movenext button until video has been fully played
Do you have any JavaScript errors in the console?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Andrea01
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 64
- Thank you received: 0
8 years 2 months ago #131712
by Andrea01
Replied by Andrea01 on topic hide movenext button until video has been fully played
All Firefox says is:
TypeError: $(...).progressbar is not a function
TypeError: $(...).progressbar is not a function
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
8 years 2 months ago #131717
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic hide movenext button until video has been fully played
Okay, that error may be preventing any subsequent JavaScript from running so you'll have to fix it. Does the error occur without mediaelements.js?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Andrea01
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 64
- Thank you received: 0
8 years 2 months ago #131721
by Andrea01
Replied by Andrea01 on topic hide movenext button until video has been fully played
no, no Errors shown without mediaelements.js!
The topic has been locked.