support Youtube noCookie Mode
This commit is contained in:
		@ -395,6 +395,8 @@ const defaults = {
 | 
			
		||||
        enabled: false,
 | 
			
		||||
        publisherId: '',
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    noCookie: false,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default defaults;
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user