aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/utils
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2019-04-25 12:02:37 +1000
committerSam Potts <sam@potts.es>2019-04-25 12:02:37 +1000
commit7a4a7dece8538b1ff23d9155d882bda01c7940ee (patch)
treef944d7a1b857ed019b172884baa16020b4c36250 /src/js/utils
parentf0d3e8c3b95886f64ef5216a665f5644929359b6 (diff)
downloadplyr-7a4a7dece8538b1ff23d9155d882bda01c7940ee.tar.lz
plyr-7a4a7dece8538b1ff23d9155d882bda01c7940ee.tar.xz
plyr-7a4a7dece8538b1ff23d9155d882bda01c7940ee.zip
Ratio improvements
Diffstat (limited to 'src/js/utils')
-rw-r--r--src/js/utils/style.js10
1 files changed, 8 insertions, 2 deletions
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;