Merge branch 'develop' of https://github.com/sampotts/plyr into develop

This commit is contained in:
Sam Potts
2019-01-08 23:34:59 +11:00
5 changed files with 11 additions and 5 deletions

View File

@ -400,11 +400,14 @@ const defaults = {
enabled: false,
publisherId: '',
},
// YouTube nocookies mode
noCookie: false,
// Preview Thumbnails plugin
previewThumbnails: {
enabled: false,
}
},
};
export default defaults;

View File

@ -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;
}

View File

@ -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

View File

@ -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) {