Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial1 1
Courses Plus Student 5,057 PointsWhat's the best solution for fluid mobile videos?
I would love to include some fluid videos (that will work on mobile too) on a responsive design project.
I have tried and actually managed to work with the design of the <video> element. While it looked very nice functionality was really bad on mobile.
I have used an Amazon S3 video that was 3.43 MB, still it was rendering forever on 152mbps WIFI. There is no way anyone would have waited long enough to watch that video.
So I've came across Todd Motto's FluidVids, which looks good but I couldn't get it working.
Here is what I would like to achieve:
1, Look great on any device 2, Disable full screen, so the call to action button is visible all the time 3, Excellent loading time (Youtube?) 4, And obviously a fluid experience
Any advice or resource would be appreciated.
:)
6 Answers
dan lematy
4,157 PointsWhy dont you just upload the video to youtube and then just use the iframe?
dan lematy
4,157 Pointsyoutube videos are responsive, just make the iframe 100%, like so
iframe { width:100%; }
1 1
Courses Plus Student 5,057 PointsThat's not really ideal because I get a vertical scrollbar, I lose the margin of the video div, the video doesn't keep it's ratio etc.
I'm sure it can be very easily done, I just need pointing out how. ☺
Boy Buijsman
13,773 PointsThere is a great article about fluid iframes on css-tricks: https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php
That one helpt me out when i needed to make one of my customers landingpage mobile friendly.
mikes02
Courses Plus Student 16,968 PointsIn addition to the CSS methods outlined on the CSS Tricks article fitvids.js is another popular option: http://fitvidsjs.com/
1 1
Courses Plus Student 5,057 PointsGuys, thanks a lot for your input! I have looked into 'fitvidsjs' as advised, still I've ended up using something incredibly simple.
This is what I used and so far so good. :)
xxxx CSS xxxx
/* Flexible iFrame */
.Flexible-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden; }
.Flexible-container iframe,
.Flexible-container object,
.Flexible-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
xxxxx HTML xxxxx
<!-- FitMyVideo --> <div class="Flexible-container"> <iframe src="http://player.vimeo.com/video/30421472?title=0&byline=0&portrait=0" width="546" height="307" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe> </div>