Postponed (maintainer needs more info)
Project:
Drupal Canvas
Version:
1.x-dev
Component:
Shape matching
Priority:
Major
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
13 May 2025 at 12:28 UTC
Updated:
13 Jan 2026 at 13:57 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leers@lauriii, do you agree that does not make sense to support, and the 3 remaining missing
$refs in the issue summary would address all needs?Comment #3
wim leersComment #4
wim leers@lauriii, also see the issue summary: do you want only (oEmbed) remote video, or also local video URLs?
Added more detail to the oEmbed video proposal.
Comment #5
lauriiiI think we should express the uploaded videos as follows in
schema.json:For oEmbed, I'm not sure we need the max width / max height here. It seems something that the component itself should handle? We may need to expose the height / width of the resource, as well as title which would make this shape as follows in
schema.json:For documents, to display a link, we'd need a bit more than just the URI in the
schema.json:Edit: I've removed the media controls and loop from the schema. Those should be handled manually outside of the schema since they would not be usually stored alongside with the video.
Comment #6
wim leersWalked @f.mazeikis through the Shape matching infrastructure. He's gonna get started on implementing the new
json-schema-definitions://experience_builder.module/videoobject shape that @lauriii proposed in #5 👍Comment #9
f.mazeikis commented@lauriii
In #5 you've proposed shapes for
videoandoembed_videoand I have some questions.videoyou've proposedposterproperty - as @ penyaskito pointed out on the draft MR - the commonly used term (and already existing property in Drupal Media API) forposterwould bethumbnail. This also applies to Youtube, vimeo and others. Is there a good reason we would not usethumbnailas terminology and the actual Drupal Mediathumbnailproperty?heightandwidthforvideoare not currently stored for video_file source, we could alter the source and add missing properties viahook_media_source_info_alter- is this what you would expect?oembed_videodescribed properties could be fetched from oEmbed resource provider (Youtube or Vimeo) - Media entity itself seems to fetch those at the runtime. Do you expect us to fetch the values and store/own them as prop inputs? Fetch the values and use them, but not store them? Do you want users to be able to provide their owntitle,widthandheight, that would override whatever oEmbed provider supplies?Depending on the answer to 3 it might look quite similar to 2 - just trying to figure out what the expectation is here, before I write a bunch of code.
Comment #10
wim leers#9:
<video poster>is not semantically the same as\Drupal\media\Entity\Media::loadThumbnail().See https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/poster and contrast with
core/modules/image/config/install/image.style.thumbnail.yml.The media thumbnail is a (typically square) image used when browsing the media library. You cannot use this for
<video poster: the aspect ratio would be wrong, and the quality is very likely far too low.Conclusion: without the ability to extract an image from a video (we definitely can't do that — Drupal's media system doesn't even do this), we must make do without a
poster. Which is fine, because as you can see:posteris optional!Conclusion: just do not populate
posterby default 👍⚠️ ⚠️ ⚠️ OTOH — what you're dealing with here is that
<video width>refers to the video display area, not the video's resolution.I bet that this is something @lauriii would like to see supported — even if you could enter bad values (e.g. specifying width/height not respecting aspect ratio etc.), because it impacts the content authoring experience a lot.
However, given the current reality of XB only allowing to use
StaticPropSources to populate SDC/code component props, this technically requires a field type + widget that providessrc(media library) +width/height(separate static inputs). This is whatAdaptedPropSourcewas intended for, but XB's UI doesn't support this yet.Conclusion: we don't allow
widthandheightto be entered either, because we cannot support it yet. Here too, that's possible, because both are optional 👍Here too, everything I wrote in response to #9.1 and #9.2 applies:
widthandheightare not the ones you seem to think these are referring to (and would requireAdaptedPropSourcein the UI), andurlis the only one that is required.tl;dr: forget about all optional key-value pairs, limit scope here to only the required ones, because they're the only ones that are feasible.
Comment #11
effulgentsia commentedComment #12
f.mazeikis commentedImplemented feedback from #10, updated
simple/videoSDC component and added newsimple/ombed_videoSDC component. This was useful for testing via UI, but not quite sure if we want to keep it.Added comments to MR, moving to needs review.
Comment #13
wim leersYAYAYAY!
First local video from Drupal's Media Library rendered via a component:
First remote video (about XB of course — Lee's talk on YouTube!) rendered via a component:
… unfortunately some kind of issue with YouTube refusing things, probably CSP-related, we can figure that out next 👍
Comment #14
wim leersFound the culprit. oEmbed videos are passed as-is:
… which is incorrect.
This should actually render something like
Why? Because that's how core renders remote videos successfully. See for yourself by doing:
/admin/config/media/media-settingsand enable stand-alone media URLs/media/NOEmbedFormatter::viewElements(), observe the different steps, specifically how$urland$resource_urlexist. This results in:I think this MR needs to perform that
https://www.youtube.com/watch?v=v747p7xEcgg👇
transformation, by adding a new computed property on the field definitions for the oEmbed-using
MediaTypebundles of theMediaentity type. That can be done usinghook_entity_bundle_field_info_alter(). The MR already needs that for something else too: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...(The
hashis coming from\Drupal\media\IFrameUrlHelper::getHash(), the rest from\Drupal\media\OEmbed\UrlResolver::getResourceUrl().)This would also result in
\hook_oembed_resource_url_alter()etc firing (see the example implementation: it rewrites all YouTube URLs to the cookieless variant!)Comment #15
wim leersMaking @f.mazeikis' observation easier to find: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1....
Comment #16
wim leersThis needs work for:
Note: I'd be totally fine with splitting this across multiple MRs, so you could already land the "local video" MR immediately.
Finally: this is not yet handling document links.
Comment #17
wim leersComment #18
wim leersComment #19
wim leersStaticPropSourcematching was already working 👍DynamicPropSourcematching was not yet working, in part due to core bugs. While this also doesn't work in HEAD for multi-bundle image media references, it's important that the shapes we define are known to be matchable to avoid painting ourselves into a corner by the time we work onContentTemplatesin the near (post-beta1) future. So, fixed that.There are still remaining caveats though, but that's definitely a pre-existing problem, and the most critical part (the video URL) is working 👍 Follow-up: #3533675: Avoid suggesting UNIX timestamp integers for `type: integer` props.
file_urifield type'surlproperty or better yet: the wholly newurlproperty we just added to thelinkfield type in #3499279: Make link widget autocomplete work (for uri and uri-reference props).The latter is what I'm currently working on, and is very unlikely to get finished in the next 1.5 hour (before the next and final sprint before beta1 starts).
So, being pragmatic: creating an MR to land just local video shape matching support, to unblock #3528396: Video prop shape: e2e test coverage for video from media library the component instance form + fix revealed bug in evaluating `StaticPropSource`s with at least local videos, because as of finishing point 2 above, that's completely working. Here it is in action in both the
all-propsSDC and the newvideoSDC:Comment #21
wim leersStill had one major concern about the new
experience_builder:videoSDC, because it conflated:See the details.
So, made that distinction a reality at all levels, resulting in this more capable UX (previously no resizing was possible):
Comment #22
wim leersThe change I made in #21 introduces a new prop:
display_width. It usestype: integer, minimum: 1.This caused 2 test failures:
+
Note that
''is literally the default value formaxin\Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem::defaultFieldSettings(). So the instance settings we're validating:Root cause:
Component::save()eventually calls\Drupal\Core\Config\Config::save(has_trusted_data: FALSE), which eventually calls\Drupal\Core\Config\StorableConfigBase::castValue(key: 'versioned_properties.active.settings.prop_field_definitions.display_width.field_instance_settings.max', value: '')😬😬😬😬😬😬😬😬
Comment #23
wim leersThis should do it: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...
Comment #25
lauriiiDiscussed with @Wim Leers about the challenges with OEmbed videos. Decided that we should descope this from beta so that we have more time to think through the right implementation for this. In the meanwhile, this can be work around by building custom components with a URL prop that references the remote video.
Comment #26
effulgentsia commentedI opened #3534599: Change video prop shape: remove `width` and `height` as a follow-up based on discussion with @lauriii and @balintbrews.
Comment #27
wim leersComment #28
larowlanCould we get an issue summary update listing the challenges that were discussed that lead to #25 - thanks!
Comment #29
wim leersYes, definitely — agreed that's very much necessary 🙈
Comment #31
wim leersFYI path has been paved for this to some extent:
x-allowed-schemesin #3530351: Decouple image+video (URI) shape matching from specific image+video file types/extensionsComment #33
heyyo commentedAny plan to support media audio file too ?
Comment #34
wim leersFelix, please update the issue summary to explain how you intend to overcome the oEmbed-related challenges. 🙏 See #28 & #25.
Comment #36
f.mazeikis commentedOn a call @lauriii clarified that initial set of document types we need to support is as follows:
Comment #37
wim leersAFAICT oEmbed support is impossible until we do #3567249: oEmbed media source plugin should not use the "string" field type. Or, alternatively, we'd need to:
timestamp|created|changedfield types.Comment #38
wim leers