Closed (fixed)
Project:
Media: YouTube
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Apr 2012 at 20:38 UTC
Updated:
16 Aug 2013 at 17:39 UTC
I see there is some effort to make the embeds responsive with max-width: 100% in the module CSS...however it's not working for me. You may want to take a look at this little trick which I implemented manually (and now videos are sized responsively): http://webdesignerwall.com/tutorials/css-elastic-videos
It's not an ideal implementation, but it's what I'm currently using. (Marking as a 'bug' simply because I see there was some attempt to make it work, but it's not currently functioning as expected)
Comments
Comment #1
RobW commentedNice link. I've been using fitvids.js which works well, but a pure markup and css method would be nice. Have you run into any browser inconsistencies?
Comment #2
Rob_Feature commentedSo far everything has worked well. You can see the implementation at http://mustardseedmedia.com/podcast and test away!
Comment #3
RobW commentedThanks. Looking good.
I also noticed that there's some .js in the Youtube and Vimeo media modules meant to make videos liquid/responsive. Problems there are:
I just glanced at the js tonight, going to dig a little deeper into it tomorrow and see what's going on. I may find that I'm off about a point or two here, but the code definitely needs a little cleanup
Comment #4
Rob_Feature commentedGreat stuff here RobW. Thanks for putting some time into it (as you can see, I just said, "I dont have time to investigate" and just fixed my case).
I agree 1000%...any user should be able to have responsive by just installing any of these. I could see a need for a "Responsive Media" module, which would implement these across the board. It would be great to write it so when it's stable, media.module could just roll it into their configs.
Comment #5
RobW commentedThanks. To condense my point: if every module adds responsiveness to what it provides, there will be 100 different ways of making the same html responsive in one site conflicting with each other every which way. IMO responsive support belongs in themes (who may have different preferences between them for which responsive techniques they're using sitewide) or a separate module that applies the same technique once across a repeated html structure sitewide. So these snippets should be removed, especially if they're not functioning. Let's respect the front end devs!
Comment #6
dddave commented@RobW
Would you care to help us out over at #1413558: Which class selector to use with embed videos from youtube and provide a little insight for us lesser talents?
Going all FitVids would be ok for me if I would understand how to do it properly. If I get a better understanding of it I would write down a beginner guide.
In general I agree with RobW that we need a universal approach for this. Providing code in each and every Media implementation would be way too much.
Comment #7
RobW commented@dddave, of course, I would be happy to. I might not get to it until after the weekend though.
Comment #8
RobW commented#1112462: YouTube videos no longer resize to fit their containers is about resizing embeds as well.
One of these should be marked as duplicate and the discussion consolidated, but not sure which. Both threads have good, unique info, and the other has patches (although 9 months old and in the opposite direction I think we should go).
Comment #9
dddave commentedI took the liberty and quoted @RobW's comment in #3 at length for my Media Group posting at http://groups.drupal.org/node/233238
Everybody feel free to chime in over there.
Comment #10
KentBye commentedThat's a nice g.d.o. thread that you've started there dddave. One more link with some responsive examples to throw in the mix is this one: http://amobil.se/2011/11/responsive-embeds/
I'm asking some of my teammates here at Metal Toad Media about this issue, and we'll be evaluating our approach over the next couple of weeks. Just wanted to chime in that this issue is on our radar.
Comment #11
RobW commentedAnother issue with active discussion that this is a semi-dupe of: #1278180: Add a library to handle fluid sizes for embedded media..
Comment #12
RobW commentedWhoops, somehow got a double post in there.
Comment #13
gmclelland commented@KentBye
One difference I see is that http://amobil.se/2011/11/responsive-embeds/ requires you to remove the width and height of the embeds whereas fitvids.js does this on the client side with jquery.
Comment #14
RobW commentedThe basic difference between FitVids and a css solution is that Fitvids calculates the aspect ratio of each video embed seperately, and applies the css padding-bottom trick for that particular aspect ratio individually to each video. If all videos on your site are the same ratio you'll get great results with a css only solution (like the tutorial posted in the issue summary, http://webdesignerwall.com/tutorials/css-elastic-videos). If you have different aspect ratios and want the videos sized exactly (no black bars), FitVids is the way to go.
If width and height are supplied in the html by
widthandheightattributes any css should override them. If they are in astyleattribute you'll need js or an!importantdeclaration to override. All embeds I've seen use thewidthandheightattributes, which shouldn't need to be removed by js in most situations. Maybe Fitvids does because they've run into an edge case I haven't.Comment #15
RobW commented@Rob_feature Just posted a patch that addresses the problems I mentioned in #3 and some of the Fitvids problems as well. #1555276: Clean up theming function, Use recommended iframe player by default, without js
Comment #16
RobW commentedPatch in the above issue has been committed to 2.x, so all standard ways of making iframes responsive (css/Uncle Dave's old padded box, fitvids.js, etc.) should work fine now!
Comment #17
mxtfitvids.js works very well, there's also a module to manage it:
http://drupal.org/project/fitvids
Comment #19
jackhutton commentedthank you. great solution, Rob.