Problem/Motivation
Background media not covering the content in appropriate way as it appear scaled up and not centered, this issue appear for all types (image, remote video, local video).
Proposed resolution
Using CSS object-fit property to specify how an <img> or <video> should be resized to fit its container. This property tells the content to fill the container in a variety of ways; such as "preserve that aspect ratio" or "stretch up and take up as much space as possible".
Also, it's better to use object-fit-polyfill (polyfill for browsers that don't support the object-fit CSS property) for old browsers as it supports IE 9+, iOS 7-, and Android 4.4.
Comments
Comment #2
rajab natshahComment #3
rajab natshahComment #4
rajab natshahThanks Odai for reporting,
I like your proposed resolution, agree on that.
I think this will support a better revamped change for Chrome, FireFox, Opera, .. ext
on Iframes too.
We may go for this change in a new 8.x-8.x branch not to affect old projects
Comment #5
rajab natshahComment #6
rajab natshahComment #7
rajab natshahFeedback by Mohammed J. Razem
Comment #8
rajab natshahComment #9
rajab natshahbare-bones demo here
https://constance.dev/object-fit-polyfill/demo/
Comment #10
rajab natshahHaving a look at
https://git.drupalcode.org/project/drupal/blob/8.8.x/core/core.libraries...
Calling with object-fit-polyfill
Comment #12
rajab natshahComment #13
rajab natshahComment #16
rajab natshahThanks, Odai for discussing and the quick reply in person
Agreed on the following:
In Varbase core we will have the library and it will be disabled.
no page attachment hook
and only
And release Varbase core
Then in the following Varbase components:
The library will be called in each needed background library as a dependency and add the following in its JavaScript behaviours
Add to that the change in CSS for Varbase Media Hero Slider and Varbase Media Header to work in the way Razem had for us in Varbase Layout Builder
Comment #18
rajab natshahComment #19
rajab natshahComment #20
rajab natshahComment #21
rajab natshah