I’m running a site that only communicates over SSL/https so if I embed a youtube video using http I will get an error message saying the site is’nt fully secure. Is it possible to rewrite something so that WordPress accepts https and still auto embeds youtube links added to the content area? Cause now, when I try to embed a https youtube link, all that is shown is the URL, no movie.
Update
I’ve tried to add providers using this code in functions.php but it does nothing:
wp_oembed_add_provider('https://youtu.be/*', 'https://youtube.com/oembed' );
wp_oembed_add_provider('#https://(www.)?youtube.com/watch.*#i', 'https://youtube.com/oembed', true);
wp_oembed_add_provider('http://youtu.be/*', 'https://youtube.com/oembed' );
wp_oembed_add_provider('#http://(www.)?youtube.com/watch.*#i', 'https://youtube.com/oembed', true);
http://core.trac.wordpress.org/ticket/18719 has a working patch now.
Edit: Plugin code to do similar until patch gets in:
Otto’s solution doesn’t work in WP 3.6, presumably because the oembeds have changed in core and now do match https://, so the added providers never get matched. Although https:// matches in core now, it always provides an http:// embed even if the original URL is https://, so we still have the same problem here.
I’ve decided to just convert all oembeds protocol-relative:
you could hack a forced https return in the functions.php file to search for iframes that have a src starting with http and replace https. [I left off the ‘be’ of these urls since some of the share urls are youtu.be and youtube.com]
Youtube supports https urls for videos (just add the “s” into the regular url). However, they also state that:
So it looks like you won’t be able to get https video feeds just yet. This appears to be confirmed by the trac link you posted: (Comment 7 by Otto42) “Until YouTube returns https results in the iframe, embedding such a link would just result in a broken page in most browsers, since the iframe isn’t SSL.”
Reference: http://apiblog.youtube.com/2011/02/https-support-for-youtube-embeds.html
You might also check out this solution: http://www.adammershon.com/display-youtube-videos-on-ssl-page/ (This would essentially “serve” the video as if it were on your page.)
(I don’t see anything newer about the subject.)