aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/utils
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2020-04-19 19:51:06 +1000
committerSam Potts <sam@potts.es>2020-04-19 19:51:06 +1000
commit9c7e429b48320f6b021baa2ed23e35a6bd9ceae5 (patch)
treee3eb0acf2ce3408bc404e2cc10cbe04a7545d21c /src/js/utils
parent502d5977d79148957828cbf313b7ef4c9f31973f (diff)
downloadplyr-9c7e429b48320f6b021baa2ed23e35a6bd9ceae5.tar.lz
plyr-9c7e429b48320f6b021baa2ed23e35a6bd9ceae5.tar.xz
plyr-9c7e429b48320f6b021baa2ed23e35a6bd9ceae5.zip
Vimeo ratio fixes
Diffstat (limited to 'src/js/utils')
-rw-r--r--src/js/utils/style.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/js/utils/style.js b/src/js/utils/style.js
index 0a37e595..c2004fcb 100644
--- a/src/js/utils/style.js
+++ b/src/js/utils/style.js
@@ -64,9 +64,10 @@ export function setAspectRatio(input) {
wrapper.style.paddingBottom = `${padding}%`;
// For Vimeo we have an extra <div> to hide the standard controls and UI
- if (this.isVimeo && this.supported.ui) {
- const height = 240;
+ if (this.isVimeo && !this.config.vimeo.premium && this.supported.ui) {
+ const height = (100 / this.media.offsetWidth) * parseInt(window.getComputedStyle(this.media).paddingBottom, 10);
const offset = (height - padding) / (height / 50);
+
this.media.style.transform = `translateY(-${offset}%)`;
} else if (this.isHTML5) {
wrapper.classList.toggle(this.config.classNames.videoFixedRatio, ratio !== null);