FitVids.js
FitVids.js copied to clipboard
Introduce a `maxAspectRatio` option to limit the height of the embedded video.
Allows the aspect ratio of the embedded video to be limited. For example, if using:
$('.selector').fitVids({'maxAspectRatio': 0.5625});
Embedded videos encoded at aspect ratios "squarer" than 16x9 will be vertically
letterboxed, i.e.: displayed centred in the .fluid-width-video-wrapper
with
black edges down the side.
My use case for this is a responsive gallery unit where I want images and videos to display at the same size (without having control of the videos that are displayed in it). Without this option, fitvids embeds the videos at the width of the container x the native aspect ratio of the video. So 4x3 videos are much deeper than 16x9 videos. With this option, I can constrain the 4x3 videos to display (centred, vertically letterboxed) within a 16x9 container.
The default maxAspectRatio
wouldn't work here because some videos (iPhone uploaded to Flickr) are in portrait.
True, but you can leave the default as none and still let users asign a maxAspectRatio if needed.
Thanks, this setting was what i was looking for, i too needed a way to restrict the videos aspect ratio.
I'm down to add this into (the mythical) FitVids 2.0, but is everyone on board for setting the default to false
and then doing a check for its "truthiness" inside the if
statement?
@davatron5000 :ship: