How to get your Youtube video embedded in your post

Anything non-technical you want to talk about, talk it over and have beer ...

How to get your Youtube video embedded in your post

Postby modman » 20 Nov 2015, 14:42

There is a little trick to getting the Youtube vids embedded

https://www.youtube.com/watch?v=o0b3ZzlRRQs

needs to be embedded as: (delete the s in the "https")
Code: Select all
[youtube]http://www.youtube.com/watch?v=o0b3ZzlRRQs[/youtube]

which gives you:

Link


hope to fix this bug permanently in a short while with upgrades of forum software
(it's that time again, has been for some time)
"The whole point of diy is diy. It's not dsoiyathodtr - do some of it yourself and then have others do the rest" (paulc)
User avatar
modman
a d m i n
 
Posts: 4246
Joined: 19 Jun 2007, 17:57
Has thanked: 2886 times
Have thanks: 495 times

Re: How to get your Youtube video embedded in your post

Postby Limadito » 21 Nov 2015, 20:08

(This is my first post on the site, even when I have been a registered user for a few years...)

A workaround for the "https://" issue is modify the YouTube bbCode in this way: replacing the "http" for the {IDENTIFIER} tag will make the bbCode work well with both protocols.

Code: Select all
[youtube]{IDENTIFIER}://www.youtube.com/watch?v={TEXT}[/youtube]


And the HTML replacement should look something like this:

Code: Select all
<object width="640" height="526"><param name="movie" value="{IDENTIFIER}://www.youtube.com/v/{TEXT}"></param><param name="wmode" value="transparent"></param><embed src="{IDENTIFIER}://www.youtube.com/v/{TEXT}?rel=0" type="application/x-shockwave-flash" allowfullscreen="true" wmode="transparent" width="640" height="526"></embed></object>


Using this bbCde the video will be displayed, no matter the YouTube link uses "http://" or "https://" .

Hope this helps! :D
Limadito
 
Posts: 2
Joined: 11 Dec 2010, 13:01
Has thanked: 2 times
Have thanks: 0 time

Re: How to get your Youtube video embedded in your post

Postby Duckman » 22 Nov 2015, 05:21


Link


Just to try as modman recommend
User avatar
Duckman
Opamp Operator
 
Posts: 1526
Joined: 20 May 2009, 02:45
Has thanked: 364 times
Have thanks: 121 times

Re: How to get your Youtube video embedded in your post

Postby Duckman » 22 Nov 2015, 05:25

And works like a charm... thanks modman (disabeled thanks button?)
User avatar
Duckman
Opamp Operator
 
Posts: 1526
Joined: 20 May 2009, 02:45
Has thanked: 364 times
Have thanks: 121 times

Re: How to get your Youtube video embedded in your post

Postby Limadito » 22 Nov 2015, 11:46

Duckman wrote:And works like a charm... thanks modman (disabeled thanks button?)

Removing the "s" by hand will work for sure, the code I've suggested do that for the user (well, not exactly, but does the job... ) :wink:
Limadito
 
Posts: 2
Joined: 11 Dec 2010, 13:01
Has thanked: 2 times
Have thanks: 0 time

Re: How to get your Youtube video embedded in your post

Postby modman » 23 Nov 2015, 12:18

Limadito wrote:
Duckman wrote:And works like a charm... thanks modman (disabeled thanks button?)

Removing the "s" by hand will work for sure, the code I've suggested do that for the user (well, not exactly, but does the job... ) :wink:

Code: Select all
Warning

The BBCode you are trying to add seems to use a {TEXT} token inside a HTML attribute. This is a possible XSS security issue. Try using the more restrictive {SIMPLETEXT} or {INTTEXT} types instead. Only proceed if you understand the risks involved and you consider the use of {TEXT} absolutely unavoidable.
"The whole point of diy is diy. It's not dsoiyathodtr - do some of it yourself and then have others do the rest" (paulc)
User avatar
modman
a d m i n
 
Posts: 4246
Joined: 19 Jun 2007, 17:57
Has thanked: 2886 times
Have thanks: 495 times

Re: How to get your Youtube video embedded in your post

Postby Limadito » 24 Nov 2015, 22:28

modman wrote:
Limadito wrote:
Duckman wrote:And works like a charm... thanks modman (disabeled thanks button?)

Removing the "s" by hand will work for sure, the code I've suggested do that for the user (well, not exactly, but does the job... ) :wink:

Code: Select all
Warning

The BBCode you are trying to add seems to use a {TEXT} token inside a HTML attribute. This is a possible XSS security issue. Try using the more restrictive {SIMPLETEXT} or {INTTEXT} types instead. Only proceed if you understand the risks involved and you consider the use of {TEXT} absolutely unavoidable.


Yes, this is a stadard message while editing that bbCode, coming from the use of the {TEXT} token in the bbCode itself and no related to the mod proposed (try to modify the size attributes of the bbCode in use, and you will get the same warning). I've been using it for few years without security issues, but if you aren't sure, don't use it. :thumbsup

There is a way to avoid that warning, and is adding a video wrapper to the common.ccs file of the theme in use. This will allow the use of the newer YT player in HTML5 capable browsers (without using Flash layer), but won't work as a drop-in replacement (you will need to create a new tag for inserting video).

At the very end of your common.ccs, add:

Code: Select all
/* Custom styles
---------------------------------------- */
.video-wrapper {
   width: 640px;
   max-width: auto;
}

.video-container {
   position: relative;
   padding-bottom: 56.25%;
   padding-top: 30px;
   height: 0;
   overflow: hidden;
}

.video-container iframe, .video-container object, .video-container embed {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
}


The bbCode in use is

Code: Select all
[yt]{IDENTIFIER}://{SIMPLETEXT}.youtube.com/watch?v={SIMPLETEXT2}[/yt]


And HTML Replacement is

Code: Select all
<div class="video-wrapper">
<div class="video-container">
<iframe class="youtube-player" type="text/html" width="640" height="526" src="{IDENTIFIER}://{SIMPLETEXT}.youtube.com/embed/{SIMPLETEXT2}?rel=0" allowfullscreen frameborder="0"></iframe>
</div>
</div>


This bbCode will not trigger the warning mentioned above.
Limadito
 
Posts: 2
Joined: 11 Dec 2010, 13:01
Has thanked: 2 times
Have thanks: 0 time


Return to Freestomp Café!

Who is online

Users browsing this forum: No registered users and 11 guests