Skip to content

Commit 4ab5930

Browse files
authored
chore: remove height from default poster (#1013)
1 parent 286aa65 commit 4ab5930

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

src/plugins/cloudinary/index.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -404,22 +404,19 @@ class CloudinaryContext {
404404
posterOpts.transformation.crop = 'scale';
405405
}
406406

407-
// Skip when source already has sizing from breakpoints/aspectRatio.
408-
const sourceHasSizing = isKeyInTransformation(sourceOpts.transformation, 'width') ||
409-
isKeyInTransformation(sourceOpts.transformation, 'aspect_ratio');
407+
// Skip when source already has width (e.g. breakpoints).
408+
const sourceHasSizing = isKeyInTransformation(sourceOpts.transformation, 'width');
410409
const playerEl = this.player.el();
411410
if (
412411
!sourceHasSizing &&
413-
playerEl?.clientWidth &&
414-
playerEl?.clientHeight
412+
playerEl?.clientWidth
415413
) {
416414
const roundUp100 = (val) => 100 * Math.ceil(val / 100);
417415
const dpr = getEffectiveDpr(sourceOpts.maxDpr);
418416

419417
posterOpts.transformation = mergeTransformations(posterOpts.transformation, {
420418
width: roundUp100(playerEl.clientWidth * dpr),
421-
height: roundUp100(playerEl.clientHeight * dpr),
422-
crop: 'limit'
419+
...(!isKeyInTransformation(posterOpts.transformation, 'crop') && { crop: 'limit' })
423420
});
424421
}
425422

0 commit comments

Comments
 (0)