diff options
author | Sam Potts <sam@potts.es> | 2017-11-08 00:37:14 +1100 |
---|---|---|
committer | Sam Potts <sam@potts.es> | 2017-11-08 00:37:14 +1100 |
commit | c948e95adea876c7c43785fe904bedd22f9c307d (patch) | |
tree | 7b134748e4dd4784becf25037344c6cb4ab608e6 /src/js/plugins | |
parent | 1a5f4b1b9e1b2b8b316997c4be33d9af240e1383 (diff) | |
download | plyr-c948e95adea876c7c43785fe904bedd22f9c307d.tar.lz plyr-c948e95adea876c7c43785fe904bedd22f9c307d.tar.xz plyr-c948e95adea876c7c43785fe904bedd22f9c307d.zip |
Looping, increase/decrease volume fix
Diffstat (limited to 'src/js/plugins')
-rw-r--r-- | src/js/plugins/vimeo.js | 14 | ||||
-rw-r--r-- | src/js/plugins/youtube.js | 13 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js index 83b6d942..f35cc927 100644 --- a/src/js/plugins/vimeo.js +++ b/src/js/plugins/vimeo.js @@ -53,7 +53,7 @@ const vimeo = { // Get Vimeo params for the iframe const options = { loop: player.config.loop.active, - autoplay: player.config.autoplay, + autoplay: player.autoplay, byline: false, portrait: false, title: false, @@ -155,6 +155,18 @@ const vimeo = { }, }); + // Loop + let { loop } = player.media; + Object.defineProperty(player.media, 'loop', { + get() { + return loop; + }, + set(input) { + loop = utils.is.boolean(input) ? input : player.config.loop.active; + player.embed.setLoop(loop); + }, + }); + // Source let currentSrc; player.embed.getVideoUrl().then(value => { diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js index 84d16488..5ff45ca8 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -76,7 +76,7 @@ const youtube = { widget_referrer: window && window.location.href, // Captions are flaky on YouTube - cc_load_policy: (this.captions.active ? 1 : 0), + cc_load_policy: this.captions.active ? 1 : 0, cc_lang_pref: this.config.captions.language, }, events: { @@ -246,18 +246,15 @@ const youtube = { switch (event.data) { case 0: // YouTube doesn't support loop for a single video, so mimick it. - if (player.config.loop.active) { + if (player.media.loop) { // YouTube needs a call to `stopVideo` before playing again instance.stopVideo(); instance.playVideo(); - - break; + } else { + utils.dispatchEvent.call(player, player.media, 'ended'); + player.media.paused = true; } - player.media.paused = true; - - utils.dispatchEvent.call(player, player.media, 'ended'); - break; case 1: |