I was using the old BB Code for Youtube but noticed that the URLs now use https instead of http and were causing issues on new posts. Also, the code generated used Youtube's old object embedding, which doesn't scale very well for certain videos. The sharing on Youtube is now all done through iframes.
I know that using "TEXT" is not a secure solution, but is it okay to use it strictly as an input variable? Here's the code I'm using right now:
BBCode usage
Code: Select all
[youtube]{TEXT1}youtube.com/watch?v={INTTEXT2}[/youtube]
HTML replacement
Code: Select all
<iframe width="640" height="360" src="//www.youtube.com/embed/{INTTEXT2}?rel=0" frameborder="0" allowfullscreen></iframe>
All the old videos load in correctly, so it's working for our site. It works with http, https, www, m.youtube, and youtube.com URLs.
What do you guys think?