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`. diff --git a/src/js/config/defaults.js b/src/js/config/defaults.js index fd56f196..5b86cceb 100644 --- a/src/js/config/defaults.js +++ b/src/js/config/defaults.js @@ -400,11 +400,14 @@ const defaults = { enabled: false, publisherId: '', }, + + // YouTube nocookies mode + noCookie: false, // Preview Thumbnails plugin previewThumbnails: { enabled: 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..0cc8fd1d 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -153,6 +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, playerVars: { autoplay: player.config.autoplay ? 1 : 0, // Autoplay hl: player.config.hl, // iframe interface language 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) {