Page 2 of 2

Re: Help making iframe embedded videos responsive

Posted: Sun Mar 13, 2016 6:18 am
by cyclops12
I should be looking to use this in the future so well done on everyone that got this working

Re: Help making iframe embedded videos responsive

Posted: Sun May 29, 2016 10:03 pm
by giproc
Width set at 100% works perfectly. The problem is the height. Fixed pixel heights work up to a point on some devices but not all. For instance on a desktop at 1440x900, a full width video will usually be much higher than the 360px height mentioned in the media@ 1220 setting above.

Is there any way to have the height of the iframe calculated responsively based on what the iframe is determined to need to attain the 100% width?

Re: Help making iframe embedded videos responsive

Posted: Sat Jun 04, 2016 3:47 pm
by Senseadv

Code: Select all

<div class="videoWrapper">
    <!-- Copy & Pasted from YouTube -->
    <iframe width="560" height="349" src="http://www.youtube.com/embed/n_dZNLr2cME?rel=0&hd=1" frameborder="0" allowfullscreen></iframe>
</div>

Code: Select all

.videoWrapper {
	position: relative;
	padding-bottom: 56.25%; /* 16:9 */
	padding-top: 25px;
	height: 0;
}
.videoWrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

Re: Help making iframe embedded videos responsive

Posted: Thu Apr 13, 2017 1:45 am
by cepcemuh
Senseadv wrote:
Sat Jun 04, 2016 3:47 pm

Code: Select all

<div class="videoWrapper">
    <!-- Copy & Pasted from YouTube -->
    <iframe width="560" height="349" src="http://www.youtube.com/embed/n_dZNLr2cME?rel=0&hd=1" frameborder="0" allowfullscreen></iframe>
</div>

Code: Select all

.videoWrapper {
	position: relative;
	padding-bottom: 56.25%; /* 16:9 */
	padding-top: 25px;
	height: 0;
}
.videoWrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}
@ Senseadv Awesome... it works perfect! Thanks for your post man!

Re: Help making iframe embedded videos responsive

Posted: Thu Apr 13, 2017 2:57 pm
by uksitebuilder
This works for me without any need to add css (on the OC default theme)

Code: Select all

<div class="row">
<div class="col-xs-12 embed-responsive embed-responsive-16by9"><iframe src="URL_TO_VIDEO_OR_PLAYLIST" frameborder="0" allowfullscreen=""></iframe></div></div>

Re: Help making iframe embedded videos responsive

Posted: Tue Feb 13, 2018 9:07 am
by AD02143
How can I add this to a specific page within information?
When I add this code to "information.twig", the embedded video shows up in all information pages.

<div class="videoWrapper">
<!-- Copy & Pasted from YouTube -->
<iframe width="560" height="349" src="http://www.youtube.com/embed/n_dZNLr2cME?rel=0&hd=1" frameborder="0" allowfullscreen></iframe>
</div>