Feature aspect ratio #4
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A problem with the
outputPlayerSizeoption is that it is not good for fluid widths, i.e. responsive design where you may usewidth: 100%; max-width: 800pxon a media element, for example.In order to have a fluid-width media element, you need the height to grow proportionally to the width and the aspect ratio of the media element. This happens by default for images, but not for videos. Instead, it is common to use the padding-top percentage trick. (when a percentage is used for padding-top or padding-bottom, it is actually a percentage of it's container width).
This adds an option
outputPlayerAspectRatiowhich outputs an additional container element, required for this common technique, and adds thestyle="padding-top: XX.XX%attribute to this element.Users must also add
position: relative;to this element, keep it at the defaultwidth: 100%, and position the media iframeposition: absolute; top: 0; left: 0; width: 100%; height: 100%. Then whatever width or max-width the outer container is set at, the height of the video will grow and shrink accordingly.note: rather inappropriately, this branch is based on the branch from #3 and so should not be merged until that PR is.