Closed malvese closed 10 months ago
Currently this seems to work as it should, so closing this but please comment if it doesn't and I'll reopen.
For instance with this vertical video: https://vimeo.com/265111898
The fetched data is:
width: 360
height: 640
aspectRatio: 177.778
This is correct, {height} / {width} = 1.77778. The library returns it as % of the width (so in this case height is 177.778% of the width), which I kept and stored this way as it seems to me that it fits the most common use-case (preserve the aspect-ratio while making the iframe responsive):
.iframe-container {
position: relative;
width: 100%;
padding-top: 177.778%;
}
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
When I call
$myvideo->aspectRatio()
, the result is always exactly 56.5 for Youtube videos, and 56.338 for Vimeo, whatever the real aspect ratio is. Typical result should be something like 1.333 or 1.78.I tested with Kirby 3.6 and 3.8, with Embed's latest version.
Workaround: For now I use
$myvideo->width()->value() / $myvideo->height()->value()
to calculate a proper aspect ratio.