Merge pull request #1292 from omarkhatibco/master

Support Youtube NoCookie mode
This commit is contained in:
Sam Potts 2019-01-06 14:10:25 +11:00 committed by GitHub
commit 6be125db87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 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