How To Force SSL in YouTube Vids?

DRE

Well-known member
Tried this, didn't work.

I run site-wide SSL on my small private forum. No real issues and I redirect http to https. The BB Code Media Sites settings are the only things I had to change.

I edited the BB Code for each media site from http to httpS in each the site URL and the iframe. It seems to work fine, and threads that contain media links keep the ssl-lock-icon when just viewing the thread. If you play one of the embedded videos, each Chrome and Firefox drop the lock icon because the bitstream data itself is delivered via http even though it was requested from an https URL(details below). But as soon as I navigate away from the thread where I watched the video back to the index or any other thread, the lock icon returns and everything works fine.

Here's the statement from the YT API blog about it. -


After a little more research, I found a workaround for this minor annoyance via an .htaccess re-write, as is described here. But I haven't gotten around to trying it yet.

It seems as though there is a very limited number of XF sites using https. It'll be interesting to see if there are more in the future.
I run site-wide SSL on my small private forum. No real issues and I redirect http to https. The BB Code Media Sites settings are the only things I had to change.

I edited the BB Code for each media site from http to httpS in each the site URL and the iframe. It seems to work fine, and threads that contain media links keep the ssl-lock-icon when just viewing the thread. If you play one of the embedded videos, each Chrome and Firefox drop the lock icon because the bitstream data itself is delivered via http even though it was requested from an https URL(details below). But as soon as I navigate away from the thread where I watched the video back to the index or any other thread, the lock icon returns and everything works fine.

Here's the statement from the YT API blog about it. -


After a little more research, I found a workaround for this minor annoyance via an .htaccess re-write, as is described here. But I haven't gotten around to trying it yet.

It seems as though there is a very limited number of XF sites using https. It'll be interesting to see if there are more in the future.
 
  • /admin.php?bb-code-media-sites/youtube/edit
  • Embed HTML
Change this entire code from:
Code:
<iframe width="500" height="300" src="http://www.youtube.com/embed/{$id}?wmode=opaque&autoplay=1" frameborder="0" allowfullscreen></iframe>
to
Code:
<iframe width="500" height="300" src="https://www.youtube.com/embed/{$id}?wmode=opaque&autoplay=1" frameborder="0" allowfullscreen></iframe>

or
Code:
<iframe width="500" height="300" src="//www.youtube.com/embed/{$id}?wmode=opaque&autoplay=1" frameborder="0" allowfullscreen></iframe>
 
What do you have in your "Embed HTML" field for YouTube in the BB Code Media Sites area of the XF admin?

Definitely works fine for me under SSL.
 
  • /admin.php?bb-code-media-sites/youtube/edit
  • Embed HTML
Change this entire code from:
Code:
<iframe width="500" height="300" src="http://www.youtube.com/embed/{$id}?wmode=opaque&autoplay=1" frameborder="0" allowfullscreen></iframe>
to
Code:
<iframe width="500" height="300" src="https://www.youtube.com/embed/{$id}?wmode=opaque&autoplay=1" frameborder="0" allowfullscreen></iframe>

or
Code:
<iframe width="500" height="300" src="//www.youtube.com/embed/{$id}?wmode=opaque&autoplay=1" frameborder="0" allowfullscreen></iframe>
Did that earlier before making this thread, didn't work.
 
What do you have in your "Embed HTML" field for YouTube in the BB Code Media Sites area of the XF admin?

Definitely works fine for me under SSL.
HTML
Code:
<iframe width="500" height="300" src="https://www.youtube.com/embed/{$id}?wmode=opaque" frameborder="0" allowfullscreen></iframe>
Match URLS
Code:
youtube.com/watch?v={$id}
youtube.com/v/{$id}
youtu.be/{$id}
youtube.com/watch?feature=player_embedded&v={$id}
 
This is what I use... try it just to test it...

Code:
<iframe src="//www.youtube.com/embed/{$id}?html5=1" width="500" height="300" frameborder="0" allowfullscreen=""></iframe>

Not specifying the protocol will just use whatever protocol the site is using automatically. Also, I have mine display as HTML5 when possible because Flash sucks.
 
This is what I use... try it just to test it...

Code:
<iframe src="//www.youtube.com/embed/{$id}?html5=1" width="500" height="300" frameborder="0" allowfullscreen=""></iframe>

Not specifying the protocol will just use whatever protocol the site is using automatically. Also, I have mine display as HTML5 when possible because Flash sucks.
This worked! Thank you!
 
So that src="// can be applied to the other bb codes? what about html5=1 is that something that is also applied to other video bb codes?
 
Not specifying the protocol will work for any embed that works on both http and https... the html5=1 thing is a YouTube-specific thing though.
 
Did that earlier before making this thread, didn't work.

The info from the first post works perfectly fine on my SSL site. I'm not running the XenMedio addon that you linked though. I wonder if that's why the edit suggestions from the first couple of posts didn't work for you.
 
Last edited:
Any particular reason why you don't use the wmode=opaque param?

I know there were some issues with earlier versions of XF without that included.
Honestly, because I never heard of it, and don't even know what it does. :) Do I need it? lol
 
Just tested it on my site... no issues with the overlay. Maybe because I force the HTML5 version rather than Flash or something... not sure. I suspect users would complain if it was an issue for certain browsers.
 
wmode is a setting for flash only. It specifies how the hidden background of the video will be. Due to a bug old IE browsers do not render any z-index correctly if wmode=opaque has not been set.
 
Last edited:
Back
Top Bottom