Skip to content

Commit

Permalink
Add custom props for video width and height.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakearchibald committed Jul 25, 2022
1 parent c122e4d commit 8aa5d6d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions shortcodes/Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ const Video = function (bucket, domain) {
${poster ? `poster="${imgix(domain)(poster)}"` : ''}
${preload ? `preload="${preload}"` : ''}
${width ? `width="${width}"` : ''}
${
// This allows the video dimensions to be used in
// an aspect-ratio CSS rule.
// This needs to be done manually because the solution standards folks
// spec'd doesn't work for <video>.
width !== undefined && height !== undefined
? `style="--vid-width: ${width}; --vid-height: ${height}"`
: ''
}
>
${src.map(s => generateSource(bucket, s))}
</video>`;
Expand Down

0 comments on commit 8aa5d6d

Please sign in to comment.