From 7a4a7dece8538b1ff23d9155d882bda01c7940ee Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Thu, 25 Apr 2019 12:02:37 +1000 Subject: Ratio improvements --- src/js/utils/style.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/js/utils') diff --git a/src/js/utils/style.js b/src/js/utils/style.js index 191e6461..e51892e5 100644 --- a/src/js/utils/style.js +++ b/src/js/utils/style.js @@ -44,8 +44,14 @@ export function getAspectRatio(input) { } // Get from embed - if (ratio === null && !is.empty(this.embed) && is.string(this.embed.ratio)) { - ratio = parse(this.embed.ratio); + if (ratio === null && !is.empty(this.embed) && is.array(this.embed.ratio)) { + ({ ratio } = this.embed); + } + + // Get from HTML5 video + if (ratio === null && this.isHTML5) { + const { videoWidth, videoHeight } = this.media; + ratio = reduceAspectRatio([videoWidth, videoHeight]); } return ratio; -- cgit v1.2.3