-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Video block: Add aspect ratio control #60911
Comments
@Drivingralle @jasmussen raised PR for this, can you please review 🙇♂ |
In order to move this issue forward, I would like to summarize my current understanding and opinions. Two PRs have been filed for this issue:
I think there are two points that need to be discussed here:
|
I think some sort of aspect ratio control would be useful for videos, especially for folks who want to preserve the aspect ratio of the video across devices without quality degradation. Improving tools for video content can only be a good thing in my opinion. I'm not sure exactly what the right way to implement would be, but off the top of my head I think a modern content management system should be able to:
|
I don't think there's any argument that aspect ratio support shouldn't be added to the Video block. The question of approach boils down to the desired use cases and priority. @up1512001 noted on his PR a desire for control over Given the expressed desire for scale options on the Video block alongside aspect ratio control, I think it deserves to be considered fully, as an independent block support or not. I'm not familiar with the desired use case for #66946 but it doesn't take much to come up with one. Perhaps a theme wants to have a grid of video blocks on a page, with all those blocks represented in the same aspect ratio. The videos to be displayed in those blocks could be in different orientations etc. and the theme author doesn't want to say clip a portrait video due to My view is our options haven't really changed during the discussion:
So to me the only real questions are;
I don't have strong opinions other than to make sure we are supporting how contributors and extenders wish to leverage core blocks. |
Apologies, I didn't read up on the context and answered pretty generically.
Did folks add text columns only for the columns block? I'm fishing for precedents 😄
I'd vote incrementally. Which is more useful to the user is all I'd ask. |
There were plans to include it for Post Excerpt and Paragraph blocks. It was also something extenders had designs on for third party blocks. So it was supposed to be more than a single-block block support. The adoption there though stalled as priorities shifted. If you're looking for a precedent for a block support that has no, or only planned, adoption in core blocks you found it 😅 |
This issue came on my radar because of how the videos embedded on the 6.7 release site are put together. For the moment, the thumbnails are square, but the videos are 16:9. The Video block already supports this, but in some browsers you'll see a jump in height when pressing play, and the square thumbnail collapses to a landscape video. Adding object-fit set to contain, would solve it for the release site, allowing the video to remain square, and uncropped when playing. Without the object-fit control, the aspect ratio control would not be useful in this case, as it would crop the video, with object-fit defaulting to cover. To that end, I'd say yes: definitely aspect ratio should be paired with an object-fit control. In fact I would argue that whenever you set dimensions of a block that do not match intrinsic dimensions from the object itself (image, video, SVG come to mind), the object fit control should become available. But certainly for image and video, which come with dimensions from the object itself, object-fit feels appropriate. Possibly Audio as well, depending on how that behaves when a thumbnail is embedded. |
Thank you for your feedback! From what I've read so far, I'm beginning to agree that the Video block needs an object-fit option. I think the important thing is whether to provide the object-fit option as block support. Because object-fit is only available for a limited number of elements, I'm not sure if providing it as an independent block support would be useful for other blocks. With that in mind, the following approaches seem ideal to me:
Either way, I think it would be better to add the aspect ratio option as block support rather than ad-hoc, since that would allow us to remove the default option or add our own custom option via theme.json. |
I'm limited in my technical insights, so I'm likely missing nuance that you can hopefully help fill in. But responding to this part:
Exactly, and even for the elements that it's available to, it's doesn't do anything on its own. A video or image with default dimensions, no matter what property you set, it's not going to visually do anything (give or take few exceptions). So it's a control that only ever works when paired with something else, and that's either width/height, or aspect ratio. Can we tie it to that support? Can we make it a property of those supports? Expanding a bit, object-fit is sort of a counterpart to
In that vein, the UI is already the same, and similar to object-fit, giving the values cover and contain are meaningless unless tied to dimensions. In discussing supports, not sure if that's meaningful or not, but wanted to mention the overlap. |
Sounds to me like we have an agreement that
I also believe we have consensus that the aspect ratio should be supplied as a block support. This should mean that the aspect ratio can be applied to a supported block type via Global Styles (including theme.json). Given that, we probably need If there is time pressure on adding the aspect ratio and object-fit support to the video block, I'm not opposed to a temporary ad-hoc solution that's forward compatible with the proposed block support. That said, I think it might be better to avoid that re-work and pursue the
I believe we only have |
What problem does this address?
By adding a portrait video natively within a video block it can happen that the video gets very big and leads to very ugly layouts. Fixing the aspect ratio makes layouts stable and predictable.
What is your proposed solution?
Port the size controls from image block to videos.
The text was updated successfully, but these errors were encountered: