-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for 4:3 Video embeds #28
Comments
a shortcode option seems right, something like?
|
It's worth noting that the style for the
Maybe what would ultimately make sense is to keep the
as a class that anyone could use via What's your opinion, @devnook? I'm not as familiar with the way our component/styling system is supposed to work. |
Proposal: change https://github.com/GoogleChrome/webdev-infra/blob/main/shortcodes/Video.js so if both "width" and "height" are provided, it generates an inline style of The default This fixes the issue for 4:3, but also all other ratios. |
That seems reasonable to me! |
It might be safer to do video {
width: 100%;
height: auto;
aspect-ratio: var(--vid-width) / var(--vid-height);
} Then it has lower specificity than an inline style. |
@jakearchibald would you add a default |
OK so this is what I think it needs, added to next.scss Add /// Video related elements
video,
.youtube {
--var-width: 16;
--var-height: 9;
position: relative;
aspect-ratio: var(--vid-width) / var(--vid-height);
} Add /// Media
video {
max-width: 100%;
height: auto;
} |
I'm wary of changing things for existing content |
Not sure what you mean? The current CSS for web.dev has 16/9: /// Video related elements
video,
.youtube {
position: relative;
aspect-ratio: 16/9;
} So if you're planning on changing that to Also because that same stylesheet has this: /// Media
video {
max-width: 100%;
} As soon as you start adding width and height (to allow the 4:3 aspect ratio to be set), then you will have a So I don't think this proposal will work without both of those, or you will break existing content. On the plus side, I think these are safe changes from some quick tests. Does that make sense? |
The alternative is to go with the simpler |
Ah, you're right. I was under the impression that
The reason I went for width and height is it means we can remove the workaround when w3c/csswg-drafts#7524 is fixed. |
Well that still depends on use changing our use of the Video embed to provide width and height. Which seems like we don't do now. Though maybe we should? Also it spreads the code between here (setting the aspect-ratio) and the site (CSS to use that aspect-ratio). Do think the But whichever you think is best. And, FYI, the reason I was looking was for another issue in the next release so looked at all the open PRs and saw this one. But the fix I wanted got released yesterday anyway without this, so will back away from this now and leave you to it! 😁 |
PR updated
Well, something needs to change with how we're currently doing it, since there's a problem with how we're currently doing it. Setting width & height on
For now. When browsers fix the issue, we can hopefully remove the code that sets the custom properties, and the code that uses them.
When browsers fix the issue, we're back to the wisdom of "set a width and height on your img/video, and you avoid CLS". If we use a |
Fair enough! It seems like it's our media uploader doesn't provide width and heights by default for videos, like it does for images. Imagine that's making it less easy to add these. |
Hmm, I wonder how easy it would be to add that. |
According to this, this is apparently the repo: https://github.com/GoogleChromeLabs/chrome-gcs-uploader but I can't see it. Not sure if restricted, or moved? |
You should have access now, unless there's an invite for you to accept. |
I'm in! Thanks. |
@argyleink has requested a clean way to use the
Video
shortcode to embed with a 4:3 aspect ratio, instead of 16:9.He's currently resorting to the following hack:
The text was updated successfully, but these errors were encountered: