Replies: 2 comments
-
Ah, it looks setting PS: Since this is in shadow DOM, Update: No JS necessary. I can simply set a class each on /* The video tag */
.video {
aspect-ratio: 16 / 9;
background-color: black;
}
/* The img tag, if you have an img-based poster. */
.poster {
aspect-ratio: 16 / 9;
object-fit: contain;
} |
Beta Was this translation helpful? Give feedback.
-
Good findings! Yes, setting the aspect-ratio or dimensions is a requisite for preventing Cumulative Layout Shift (CLS) (https://web.dev/articles/cls) We do this in all our embeds as well. |
Beta Was this translation helpful? Give feedback.
-
It looks like the
<video>
element inside the shadow DOM overflows the<media-controller>
in light DOM in height. A percentage height has no effect whatsoever. You can see thatheight: 100%
is already set, but even if I change to10%
, nothing happens.Only fixed pixel values like
403px
or something like10vh
works, as you can see in second picture below. I already read the issue #206 but it doesn't seem to have the info I need. Although it does state the following:It appears that for me too, the fix for this issue would be JavaScript based which in my opinion is a hack (workaround).
Au contraire, a proper solution would be one that would work automatically by CSS alone, without any manipulations by JavaScript.
Regarding the poster image, if I have an
<img slot="poster">
, I also have to setheight: 100%
andobject-fit: contain
on it. This is still tolerable since it's automatic and doesn't need fixed pixel values.Note: I am using Cloudflare plugin, so IDK if it's related to the plugin or the main MediaController.Actually it's just a plain video tag, but using HLS.js for HLS support.Beta Was this translation helpful? Give feedback.
All reactions