- Posts: 1
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Autoplay and Remove Controls in Embedded Video
- CessnaStudy
- Topic Author
- Offline
- New Member
Less
More
3 years 11 months ago #199789
by CessnaStudy
Autoplay and Remove Controls in Embedded Video was created by CessnaStudy
Dear Expert,
I am trying to embed a video that will play a video once automatically (autoplay) and with no controls visible to the user.
Ideally there is no pause function. There cannot be a replay (loop) function either, as each participant should see the video only once.
I tried embedding the video using iframe and adding in controls=0 and loop=0 and autoplay=1. This hides the controls except for the replay (which is a problem), but the video will not autoplay unless I refresh the frame.
<iframe src="PATH?autoplay=1&controls=0&loop=0" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>
Thanks for the advice.
I am trying to embed a video that will play a video once automatically (autoplay) and with no controls visible to the user.
Ideally there is no pause function. There cannot be a replay (loop) function either, as each participant should see the video only once.
I tried embedding the video using iframe and adding in controls=0 and loop=0 and autoplay=1. This hides the controls except for the replay (which is a problem), but the video will not autoplay unless I refresh the frame.
<iframe src="PATH?autoplay=1&controls=0&loop=0" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>
Thanks for the advice.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12937
- Thank you received: 3979
3 years 11 months ago #199796
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Autoplay and Remove Controls in Embedded Video
Hi,
here how I implemented this short time ago.
Without IFrame:
<div class="embed-responsive embed-responsive-16by9">
<video autoplay="autoplay" id="myvideo"><source src="http(s)/myServer.com/myFolder/myVideo.mp4" type="video/mp4" /> browser does not support this</video>
</div>
And with a little snippet you may
hide the "next" button till the end of the video:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Hide the "Next" button
$('#ls-button-submit').hide();
var vid = document.getElementById("myvideo");
vid.volume = 0.3;
vid.onended = function() {
// Show the "Next" button
$('#ls-button-submit').show();
}
});
</script>
or proceed to the next page at the end of the video:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Hide the "Next" button
$('#ls-button-submit').hide();
var vid = document.getElementById("myvideo");
vid.volume = 0.3;
vid.onended = function() {
// Show the "Next" button
$('#ls-button-submit').trigger('click');
}
});
</script>
By the way: You see the line vid.volume = 0.3;
If there are no controls you may set the volume of the video.
Joffm
here how I implemented this short time ago.
Without IFrame:
<div class="embed-responsive embed-responsive-16by9">
<video autoplay="autoplay" id="myvideo"><source src="http(s)/myServer.com/myFolder/myVideo.mp4" type="video/mp4" /> browser does not support this</video>
</div>
And with a little snippet you may
hide the "next" button till the end of the video:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Hide the "Next" button
$('#ls-button-submit').hide();
var vid = document.getElementById("myvideo");
vid.volume = 0.3;
vid.onended = function() {
// Show the "Next" button
$('#ls-button-submit').show();
}
});
</script>
or proceed to the next page at the end of the video:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Hide the "Next" button
$('#ls-button-submit').hide();
var vid = document.getElementById("myvideo");
vid.volume = 0.3;
vid.onended = function() {
// Show the "Next" button
$('#ls-button-submit').trigger('click');
}
});
</script>
By the way: You see the line vid.volume = 0.3;
If there are no controls you may set the volume of the video.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
3 years 11 months ago #199820
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 Autoplay and Remove Controls in Embedded Video
You should be careful with autoplay and hiding controls. Many browsers now will not allow autoplay unless the sound is also muted.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.