• Resolved jhtjards

    (@jhtjards)


    Hi, just a quick suggestion:
    Include youtube-nocookie.com in your script that loads video thumbnails. Embeds work the same and you can still use the same thumbnail url starting with https://i.ytimg.com/…

    Maybe a bit of a fringe case, but I have hope that this isn’t too hard to implement.

    On my site I convert any standard youtube embed into nocookie with this script:

    // Add this to your plugin or functions.php file of your theme
    
    function youtube_add_nocookie( $cached_html, $url, $attr, $post_id ) {
        if ( preg_match('#https?://(www\.)?youtu#i', $url) ) {
    		return preg_replace(
    			'#src=(["\'])(https?:)?//(www\.)?youtube\.com#i',
    			'src=$1$2//$3youtube-nocookie.com',
    			$cached_html
    		);
    	}
    	return $cached_html;
    }
    
    add_filter( 'embed_oembed_html', 'youtube_add_nocookie', 99, 4 );
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matthias Kittsteiner

    (@kittmedia)

    Hi there!

    It’s simply not needed. You shouldn’t use youtube-nocookie.com by yourself. Embed Privacy automatically replaces all links from youtube.com to youtube-nocookie.com and handles the thumbnails correctly.

    Thread Starter jhtjards

    (@jhtjards)

    Oh, cool! Didn’t know that!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Suggestion: Video Thumbnails for youtube-nocookie.com’ is closed to new replies.