support Youtube noCookie Mode

This commit is contained in:
Omar Khatib 2018-12-13 17:30:10 +01:00
parent e8d2f23b81
commit 11618353ea
3 changed files with 5 additions and 1 deletions

View File

@ -395,6 +395,8 @@ const defaults = {
enabled: false,
publisherId: '',
},
noCookie: 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,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