From 119b471b84f8e2a25c61a09c0905d429a475407d Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Tue, 17 Apr 2018 23:51:23 +1000 Subject: More bug fixes --- src/js/plugins/vimeo.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/js/plugins/vimeo.js') diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js index 3aac5b2d..a250d096 100644 --- a/src/js/plugins/vimeo.js +++ b/src/js/plugins/vimeo.js @@ -35,10 +35,14 @@ const vimeo = { setAspectRatio(input) { const ratio = utils.is.string(input) ? input.split(':') : this.config.ratio.split(':'); const padding = 100 / ratio[0] * ratio[1]; - const height = 240; - const offset = (height - padding) / (height / 50); this.elements.wrapper.style.paddingBottom = `${padding}%`; - this.media.style.transform = `translateY(-${offset}%)`; + + if (this.supported.ui) { + const height = 240; + const offset = (height - padding) / (height / 50); + + this.media.style.transform = `translateY(-${offset}%)`; + } }, // API Ready @@ -55,6 +59,7 @@ const vimeo = { speed: true, transparent: 0, gesture: 'media', + playsinline: !this.config.fullscreen.iosNative, }; const params = utils.buildUrlParams(options); @@ -88,6 +93,11 @@ const vimeo = { player.media.paused = true; player.media.currentTime = 0; + // Disable native text track rendering + if (player.supported.ui) { + player.embed.disableTextTrack(); + } + // Create a faux HTML5 API using the Vimeo API player.media.play = () => { player.embed.play().then(() => { -- cgit v1.2.3 From a97b08e8ea0022646eae005ce64a7edf8b26fb29 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Wed, 18 Apr 2018 18:29:43 +1000 Subject: ARIA and Vimeo fixes --- src/js/plugins/vimeo.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/js/plugins/vimeo.js') diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js index a250d096..24003d3f 100644 --- a/src/js/plugins/vimeo.js +++ b/src/js/plugins/vimeo.js @@ -134,7 +134,9 @@ const vimeo = { utils.dispatchEvent.call(player, player.media, 'seeking'); // Seek after events - player.embed.setCurrentTime(time); + player.embed.setCurrentTime(time).catch(() => { + // Do nothing + }); // Restore pause state if (paused) { @@ -320,6 +322,15 @@ const vimeo = { if (parseInt(data.percent, 10) === 1) { utils.dispatchEvent.call(player, player.media, 'canplaythrough'); } + + // Get duration as if we do it before load, it gives an incorrect value + // https://github.com/sampotts/plyr/issues/891 + player.embed.getDuration().then(value => { + if (value !== player.media.duration) { + player.media.duration = value; + utils.dispatchEvent.call(player, player.media, 'durationchange'); + } + }); }); player.embed.on('seeked', () => { -- cgit v1.2.3