Ratio improvements

This commit is contained in:
Sam Potts
2019-04-25 12:02:37 +10:00
parent f0d3e8c3b9
commit 7a4a7dece8
5 changed files with 33 additions and 32 deletions

View File

@ -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;