From 11618353ea0f35138d147261ed0fcc76e4e042a1 Mon Sep 17 00:00:00 2001 From: Omar Khatib Date: Thu, 13 Dec 2018 17:30:10 +0100 Subject: [PATCH 1/5] support Youtube noCookie Mode --- src/js/config/defaults.js | 2 ++ src/js/config/types.js | 2 +- src/js/plugins/youtube.js | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/config/defaults.js b/src/js/config/defaults.js index c3f97eee..dc2e469d 100644 --- a/src/js/config/defaults.js +++ b/src/js/config/defaults.js @@ -395,6 +395,8 @@ const defaults = { enabled: false, publisherId: '', }, + + noCookie: false, }; export default defaults; diff --git a/src/js/config/types.js b/src/js/config/types.js index c9d50937..e0ccdaff 100644 --- a/src/js/config/types.js +++ b/src/js/config/types.js @@ -19,7 +19,7 @@ export const types = { */ export function getProviderByUrl(url) { // YouTube - if (/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$/.test(url)) { + if (/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(url)) { return providers.youtube; } diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js index 73175c14..7d488814 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -153,10 +153,12 @@ const youtube = { // https://developers.google.com/youtube/iframe_api_reference player.embed = new window.YT.Player(id, { videoId, + host: player.config.noCookie ? 'https://www.youtube-nocookie.com' : undefined, // Only show controls if not fully supported playerVars: { autoplay: player.config.autoplay ? 1 : 0, // Autoplay hl: player.config.hl, // iframe interface language controls: player.supported.ui ? 0 : 1, // Only show controls if not fully supported + rel: 0, // No related vids showinfo: 0, // Hide info iv_load_policy: 3, // Hide annotations From 88ffd0f138b3db1e16dd689d9070dcd8fed4a845 Mon Sep 17 00:00:00 2001 From: Omar Khatib Date: Thu, 13 Dec 2018 17:31:15 +0100 Subject: [PATCH 2/5] remove comment --- src/js/plugins/youtube.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js index 7d488814..ea52df00 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -153,7 +153,7 @@ const youtube = { // https://developers.google.com/youtube/iframe_api_reference player.embed = new window.YT.Player(id, { videoId, - host: player.config.noCookie ? 'https://www.youtube-nocookie.com' : undefined, // Only show controls if not fully supported + host: player.config.noCookie ? 'https://www.youtube-nocookie.com' : undefined, playerVars: { autoplay: player.config.autoplay ? 1 : 0, // Autoplay hl: player.config.hl, // iframe interface language From 0ff47fe3ea8a7598c3e54e666de6ef0defd34b6a Mon Sep 17 00:00:00 2001 From: Simon Bobrov Date: Tue, 18 Dec 2018 17:27:07 +0100 Subject: [PATCH 3/5] Add Angular plugin reference --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 281ddd3f..af607cf0 100644 --- a/readme.md +++ b/readme.md @@ -42,11 +42,13 @@ Some awesome folks have made plugins for CMSs and Components for JavaScript fram | Type | Maintainer | Link | | --------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | WordPress | Brandon Lavigne ([@drrobotnik](https://github.com/drrobotnik)) | [https://wordpress.org/plugins/plyr/](https://wordpress.org/plugins/plyr/) | +| Angular | Simon Bobrov ([@smnbbrv](https://github.com/smnbbrv)) | [https://github.com/smnbbrv/ngx-plyr](https://github.com/smnbbrv/ngx-plyr) | | React | Jose Miguel Bejarano ([@xDae](https://github.com/xDae)) | [https://github.com/xDae/react-plyr](https://github.com/xDae/react-plyr) | | Vue | Gabe Dunn ([@redxtech](https://github.com/redxtech)) | [https://github.com/redxtech/vue-plyr](https://github.com/redxtech/vue-plyr) | | Neos | Jon Uhlmann ([@jonnitto](https://github.com/jonnitto)) | [https://packagist.org/packages/jonnitto/plyr](https://packagist.org/packages/jonnitto/plyr) | | Kirby | Dominik Pschenitschni ([@dpschen](https://github.com/dpschen)) | [https://github.com/dpschen/kirby-plyrtag](https://github.com/dpschen/kirby-plyrtag) | + ## Quick setup Here's a quick run through on getting up and running. There's also a [demo on Codepen](http://codepen.io/sampotts/pen/jARJYp). You can grab all of the source with [NPM](https://www.npmjs.com/package/plyr) using `npm install plyr`. From 6d9d315ca741f5472902c0f961591fdff9bbf946 Mon Sep 17 00:00:00 2001 From: Jimmy Jia Date: Thu, 20 Dec 2018 13:05:14 -0500 Subject: [PATCH 4/5] fix: Use Math.trunc instead of parseInt --- src/js/utils/time.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/utils/time.js b/src/js/utils/time.js index 7c9860fd..2deccf65 100644 --- a/src/js/utils/time.js +++ b/src/js/utils/time.js @@ -5,9 +5,9 @@ import is from './is'; // Time helpers -export const getHours = value => parseInt((value / 60 / 60) % 60, 10); -export const getMinutes = value => parseInt((value / 60) % 60, 10); -export const getSeconds = value => parseInt(value % 60, 10); +export const getHours = value => Math.trunc((value / 60 / 60) % 60, 10); +export const getMinutes = value => Math.trunc((value / 60) % 60, 10); +export const getSeconds = value => Math.trunc(value % 60, 10); // Format time to UI friendly string export function formatTime(time = 0, displayHours = false, inverted = false) { From 1c79ce70c9a3eb46c8a8a319aee840c65a5571cd Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Sun, 6 Jan 2019 14:09:49 +1100 Subject: [PATCH 5/5] Update youtube.js --- src/js/plugins/youtube.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js index ea52df00..0cc8fd1d 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -158,7 +158,6 @@ const youtube = { autoplay: player.config.autoplay ? 1 : 0, // Autoplay hl: player.config.hl, // iframe interface language controls: player.supported.ui ? 0 : 1, // Only show controls if not fully supported - rel: 0, // No related vids showinfo: 0, // Hide info iv_load_policy: 3, // Hide annotations