This is How to Simply Embed ANY Youtube & Google Video

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
hedd gwynfor
Translator
Posts: 17
Joined: Tue Jan 01, 2008 8:07 pm

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by hedd gwynfor » Wed Jan 23, 2008 12:33 am

This is brilliant, and works perfectly for youtube. I've tried all of the other suggestions, but they either didn't work, or meant I had to modify php files. Is there a similar way of showing individual bands myspace player on phpBB3??
Tanner wrote:If you want to embed the youtube link *WITHOUT MODIFING PHP FILES*, use this code I've written for my board. This code is RIGHT in the form.. while the other I've seen in previous replies is NOT. (e.g. you cant embed the video url after "<param name="movie" value="http://www.youtube.com/v/" because it is WRONG)

Simply, you have to use JAVASCRIPT to extract the video code from the youtube url.
I use the Split() function, which searches for the "?v=" string, splitting the URL in two parts. The second part obviously contains the video Code.
At last, I use "document.write()" to write the resulting embed code, with the video code in the right position, resulting in the video being published correctly.
That's all folks, enjoy.

BBCODE:

Code: Select all

[youtube]{URL}[/youtube]

HTML CODE:

Code: Select all

<script language="Javascript">
var a = '{URL}';
var temp = new Array();
temp = a.split('?v=');
document.write('<object width="425" height="373"><param name="movie" value="http://www.youtube.com/v/' + temp[1] + '&rel=0&color1=0xd6d6d6&color2=0xf0f0f0&border=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + temp[1] + '&rel=0&color1=0xd6d6d6&color2=0xf0f0f0&border=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="373"></embed></object>');
</script>

riots
Registered User
Posts: 8
Joined: Tue Dec 18, 2007 5:51 pm

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by riots » Mon Jan 28, 2008 5:10 am

where do you put the html code?

User avatar
kjartana
Registered User
Posts: 1
Joined: Mon Mar 10, 2008 7:38 pm
Location: Bergen, Norway
Contact:

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by kjartana » Mon Mar 10, 2008 7:46 pm

ever-fresh wrote: Thanx its working for me :)
can u plz Edit These codes for Full URL ? like:

Code: Select all

[metacafe]www.metacafe.com/watch/769503/su_35_extreme_moves[/metacafe]
actualy i noted, my website Visitors are very lazzy. :(
they will put the link directly to Post, just like Youtube full URL.
thanx..

Hi, I also have lazy members. This is working for me:

BBCode:

Code: Select all

[MetaCafe]http://www.metacafe.com/watch/{NUMBER}/{SIMPLETEXT}/[/MetaCafe]
HTML Replacement:

Code: Select all

<embed src="http://www.metacafe.com/fplayer/{NUMBER}/{SIMPLETEXT}.swf" width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"> </embed><br><font size = 1><a href="http://www.metacafe.com/watch/{NUMBER}/{SIMPLETEXT}/">{SIMPLETEXT}</a> - <a href="http://www.metacafe.com/">More amazing videos are a click away</a></font>
This works when using the complete link. It is not thoroughly tested, so it may be faulty. I haven't had any complaints this far though...

anain
Registered User
Posts: 1
Joined: Sat Mar 29, 2008 9:43 pm

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by anain » Tue Apr 01, 2008 12:12 am

If you want to embed the youtube link *WITHOUT MODIFING PHP FILES*, use this code I've written for my board. This code is RIGHT in the form.. while the other I've seen in previous replies is NOT. (e.g. you cant embed the video url after "<param name="movie" value="http://www.youtube.com/v/" because it is WRONG)

Simply, you have to use JAVASCRIPT to extract the video code from the youtube url.
I use the Split() function, which searches for the "?v=" string, splitting the URL in two parts. The second part obviously contains the video Code.
At last, I use "document.write()" to write the resulting embed code, with the video code in the right position, resulting in the video being published correctly.
That's all folks, enjoy.

BBCODE:

Code: Select all
[youtube]{URL}[/youtube]




HTML CODE:

Code: Select all
<script language="Javascript">
var a = '{URL}';
var temp = new Array();
temp = a.split('?v=');
document.write('<object width="425" height="373"><param name="movie" value="http://www.youtube.com/v/' + temp[1] + '&rel=0&color1=0xd6d6d6&color2=0xf0f0f0&border=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + temp[1] + '&rel=0&color1=0xd6d6d6&color2=0xf0f0f0&border=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="373"></embed></object>');
</script>
Ok this seems to work for me however. When I click on the video on my forums it tells me "I'm sorry this video is no longer available" but if I access the video via youtube it works perfectly so the video is still available. Any ideas? =\

-edit- Actually nevermind. I see that on the youtube video area the 'embed' option was disable by request. Bastards >=(

skadamo
Registered User
Posts: 10
Joined: Fri Jan 07, 2005 4:17 pm

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by skadamo » Wed Apr 30, 2008 8:03 pm

Great thread!

One thing I noticed (bug?) is if you don't have any other text in the post besides the embeded youTube video the BB code does not resolve to HTML. It remains as posted. Whatever. I am referring to frotosringfinger solution.

Anyway, thanks a lot for the useful info!

ethix
Registered User
Posts: 43
Joined: Tue Apr 15, 2008 8:03 pm

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by ethix » Mon May 12, 2008 10:57 am

This doesnt work for me...i made the bbcode and put stuff in right place but it only shows the code.

aninhas103
Registered User
Posts: 32
Joined: Tue May 06, 2008 1:26 pm

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by aninhas103 » Mon May 12, 2008 2:00 pm

which code is the right anyway? for phpbb3?
there are so many codes on this thread :roll:

circpros
Registered User
Posts: 61
Joined: Sun Mar 07, 2004 5:38 am

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by circpros » Mon Jun 09, 2008 7:13 am

aninhas103 wrote:which code is the right anyway? for phpbb3?
there are so many codes on this thread :roll:

Try this one:

http://www.phpbb.com/community/viewtopi ... 5#p3022745

I've tried several of the suggested solutions, and this one seems on balance to be the best...... just one person's opinion, but it doesn't inject html into the bb code, and actually displays the videos. Several didn't work - presumably because they were for release candidates that had changes in the 3.0.1 version....

At any rate.... this worked for me flawlessly on three forums with no hassle.

nopf
Registered User
Posts: 78
Joined: Mon May 27, 2002 8:20 pm

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by nopf » Fri Jun 20, 2008 10:46 pm

Tanner wrote:If you want to embed the youtube link *WITHOUT MODIFING PHP FILES*, use this code I've written for my board. This code is RIGHT in the form.. while the other I've seen in previous replies is NOT. (e.g. you cant embed the video url after "<param name="movie" value="http://www.youtube.com/v/" because it is WRONG)

Simply, you have to use JAVASCRIPT to extract the video code from the youtube url.
I use the Split() function, which searches for the "?v=" string, splitting the URL in two parts. The second part obviously contains the video Code.
At last, I use "document.write()" to write the resulting embed code, with the video code in the right position, resulting in the video being published correctly.
That's all folks, enjoy.

BBCODE:
[youtube]{URL}[/youtube]


HTML CODE:
<script language="Javascript">
var a = '{URL}';
var temp = new Array();
temp = a.split('?v=');
document.write('<object width="425" height="373"><param name="movie" value="http://www.youtube.com/v/' + temp[1] + '&rel=0&color1=0xd6d6d6&color2=0xf0f0f0&border=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + temp[1] + '&rel=0&color1=0xd6d6d6&color2=0xf0f0f0&border=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="373"></embed></object>');
</script>
This worked perfectly. Thanks Tanner.

dsims
Registered User
Posts: 4
Joined: Thu Jul 03, 2008 4:57 pm

I found that this works for me and is XHTML(strict) complian

Post by dsims » Thu Jul 03, 2008 5:06 pm

I found that this works for me and is XHTML(strict) compliant
After going to ACP->Posting->bbcodes
put this in the BBCode usage text box

Code: Select all

[youtube=http://www.youtube.com/watch?v={TEXT}][/youtube]
And then in the HTML replacement text box

Code: Select all

<div><object data="http://www.youtube.com/v/{TEXT}&rel=1" width="425" height="355" type="application/x-shockwave-flash"><param name="movie" value="http://www.youtube.com/v/{TEXT}&rel=1" /><param name="wmode" value="transparent" /></object></div>
of course you can change the div style to let text wrap around the video i.e.

Code: Select all

<div style="float:left">
I'm a standards junkie I even wrote a post on getting flash to validate at http://h8ersclub.com/getting-flash-to-validate/
I hope this helps

User avatar
blazes
Registered User
Posts: 579
Joined: Mon Feb 20, 2006 7:20 am

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by blazes » Thu Jul 03, 2008 5:36 pm

I just use:

Code: Select all

[youtube]http://www.youtube.com/watch?v={TEXT}[/youtube]
And:

Code: Select all

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/{TEXT}"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/{TEXT}" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
Image
I'm lazy and don't check my MOD support threads very often. If you need help and I'm not replying in the thread, PM me and yell.

dsims
Registered User
Posts: 4
Joined: Thu Jul 03, 2008 4:57 pm

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by dsims » Fri Jul 04, 2008 9:24 pm

I was just woinder ing if this would be a security issue without writing some sort of javascript to check that all the {TEXT} is just alphanumeric?

dsims
Registered User
Posts: 4
Joined: Thu Jul 03, 2008 4:57 pm

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by dsims » Sat Jul 05, 2008 1:33 am

Never mind I actually just used the method by blazes. Except the embed tag is not xhtml strict compliant so I used

Code: Select all

    <div><object data="http://www.youtube.com/v/{SIMPLETEXT}&rel=1" width="425" height="355" type="application/x-shockwave-flash"><param name="movie" value="http://www.youtube.com/v/{SIMPLETEXT}&rel=1" /><param name="wmode" value="transparent" /></object></div>

johnnybiggles
Registered User
Posts: 43
Joined: Mon Jul 21, 2008 3:19 pm

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by johnnybiggles » Mon Aug 11, 2008 2:10 am

I've been to another board (a vBulletin board though) where you can simply go to Youtube/Myspace, copy the address from your browser address box, paste it in your message, click "Submit Reply" and BAM... the vid appears in the post and you can have text below or above it to explain or comment or whatever. I've skipped thru this thread (since it's pretty long) and it doesn't seem to be so simple. Am I right? Did i miss something or is there some way of the board detecting Youtube/Myspace Vid links automatically when you submit a post? And was a bit confused as to where to edit the code and which file(s) are to be edited. Is there a simple Mod that can be installed to make embedding vids easy?

User avatar
DragonMaster1
Registered User
Posts: 994
Joined: Tue Aug 17, 2004 11:04 am
Name: Terry
Contact:

Re: This is How to Simply Embed ANY Youtube & Google Video

Post by DragonMaster1 » Sun Aug 17, 2008 3:58 pm

hedd gwynfor wrote:This is brilliant, and works perfectly for youtube. I've tried all of the other suggestions, but they either didn't work, or meant I had to modify php files. Is there a similar way of showing individual bands myspace player on phpBB3??
Tanner wrote:If you want to embed the youtube link *WITHOUT MODIFING PHP FILES*, use this code I've written for my board. This code is RIGHT in the form.. while the other I've seen in previous replies is NOT. (e.g. you cant embed the video url after "<param name="movie" value="http://www.youtube.com/v/" because it is WRONG)

Simply, you have to use JAVASCRIPT to extract the video code from the youtube url.
I use the Split() function, which searches for the "?v=" string, splitting the URL in two parts. The second part obviously contains the video Code.
At last, I use "document.write()" to write the resulting embed code, with the video code in the right position, resulting in the video being published correctly.
That's all folks, enjoy.

BBCODE:

Code: Select all

[youtube]{URL}[/youtube]

HTML CODE:

Code: Select all

<script language="Javascript">
var a = '{URL}';
var temp = new Array();
temp = a.split('?v=');
document.write('<object width="425" height="373"><param name="movie" value="http://www.youtube.com/v/' + temp[1] + '&rel=0&color1=0xd6d6d6&color2=0xf0f0f0&border=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + temp[1] + '&rel=0&color1=0xd6d6d6&color2=0xf0f0f0&border=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="373"></embed></object>');
</script>
Works PERFECTLY - THANX MUCH!!!

Locked

Return to “[3.0.x] Support Forum”