support Youtube noCookie Mode
This commit is contained in:
		| @ -395,6 +395,8 @@ const defaults = { | |||||||
|         enabled: false, |         enabled: false, | ||||||
|         publisherId: '', |         publisherId: '', | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|  |     noCookie: false, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| export default defaults; | export default defaults; | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ export const types = { | |||||||
|  */ |  */ | ||||||
| export function getProviderByUrl(url) { | export function getProviderByUrl(url) { | ||||||
|     // YouTube |     // 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; |         return providers.youtube; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | |||||||
| @ -153,10 +153,12 @@ const youtube = { | |||||||
|         // https://developers.google.com/youtube/iframe_api_reference |         // https://developers.google.com/youtube/iframe_api_reference | ||||||
|         player.embed = new window.YT.Player(id, { |         player.embed = new window.YT.Player(id, { | ||||||
|             videoId, |             videoId, | ||||||
|  |             host: player.config.noCookie ? 'https://www.youtube-nocookie.com' : undefined, // Only show controls if not fully supported | ||||||
|             playerVars: { |             playerVars: { | ||||||
|                 autoplay: player.config.autoplay ? 1 : 0, // Autoplay |                 autoplay: player.config.autoplay ? 1 : 0, // Autoplay | ||||||
|                 hl: player.config.hl, // iframe interface language |                 hl: player.config.hl, // iframe interface language | ||||||
|                 controls: player.supported.ui ? 0 : 1, // Only show controls if not fully supported |                 controls: player.supported.ui ? 0 : 1, // Only show controls if not fully supported | ||||||
|  |  | ||||||
|                 rel: 0, // No related vids |                 rel: 0, // No related vids | ||||||
|                 showinfo: 0, // Hide info |                 showinfo: 0, // Hide info | ||||||
|                 iv_load_policy: 3, // Hide annotations |                 iv_load_policy: 3, // Hide annotations | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user