File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,17 @@ export const LoopVideoInArticle = ({
2929 return null ;
3030 }
3131
32+ const calculateAspectRatio = ( ) : number => {
33+ const dimensions = firstVideoAsset ?. dimensions ;
34+
35+ if ( dimensions ) {
36+ return dimensions . width / dimensions . height ;
37+ }
38+
39+ // Default aspect ratio if dimensions are not available
40+ return 5 / 4 ;
41+ } ;
42+
3243 return (
3344 < >
3445 < Island priority = "critical" defer = { { until : 'visible' } } >
@@ -39,6 +50,7 @@ export const LoopVideoInArticle = ({
3950 fallbackImageAspectRatio = {
4051 ( firstVideoAsset ?. aspectRatio ?? '5:4' ) as FEAspectRatio
4152 }
53+ containerAspectRatio = { calculateAspectRatio ( ) }
4254 fallbackImageLoading = "lazy"
4355 fallbackImageSize = "small"
4456 height = { firstVideoAsset ?. dimensions ?. height ?? 400 }
You can’t perform that action at this time.
0 commit comments