phpbb3 youtube/google video BBCODE

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Scam Warning
wctin
Registered User
Posts: 3
Joined: Sat May 05, 2007 7:00 pm

phpbb3 youtube/google video BBCODE

Post by wctin » Sat May 05, 2007 7:18 pm

i made a little bbcode sample for youtube/google video

What this does is allow users to embed youtube or google videos in their posts without having to let full access to flash..

additionally it will remove the "click here to activate this control" message that internet explorers experience when flash is embed on their page..

first add a new bbcode as follows for google

Code: Select all

[google]{text}[/google]
Next add the html replacement for the google bbcode

Code: Select all

<script>
swfg("{text}");
</script>
now add a new bbcode as follows for youtube

Code: Select all

[youtube]{text}[/youtube]
Next add the html replacement for the youtube bbcode

Code: Select all

<script>
swfy("{text}");
</script>
Now finally save the following as "video.js" and point to it in your overall header template like this
<script src=http://yoursite.com/video.js></script>

Code: Select all

function swfg(URL)
{

document.write('<embed src="http://video.google.com/googleplayer.swf?docId=' + URL + '" wmode="transparent" style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" flashvars=""></embed>');

}
function swfy(URL)
{

document.write('<embed src="http://www.youtube.com/v/' + URL + '" wmode="transparent" style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" flashvars=""></embed>');

}

If you would like to have the youtube videos "autostart" like they do on the youtube site you can add "autoplay=1" to the flashvars in the js file if you want the video to autostart and loop try "autostart=1&loop=1"

so even if you have flash turned on by default you may still want to use this code to have youtube videos loop or autostart , bypassing the default method of NOT looping and NOT autostarting.

p.s. in the hints tab of the bbcode you may want explain that they only need to insert the "ID" of the video not the complete url

someone may want to edit the js file to include other popular video sites,

User avatar
SHS`
Former Team Member
Posts: 6615
Joined: Wed Jul 04, 2001 9:13 am
Location: Yellow Beach, Nine Dragons, Hong Kong
Name: Jonathan Stanley
Contact:

Re: phpbb3 youtube/google video BBCODE

Post by SHS` » Sat May 05, 2007 8:37 pm

phpBB3's setting for allow Flash (as in via the BBCode [flash]) is a completely different setting and doesn't effect custom BBCodes.

Secondly, usage of <embed> is invalid XHTML 1.0 Strict (2nd Edition), even if content is inserted via Javascript.
Jonathan “SHS`” Stanley • 史德信
Image

ashiitk
Registered User
Posts: 1
Joined: Sun May 06, 2007 4:20 am

Re: phpbb3 youtube/google video BBCODE

Post by ashiitk » Sun May 06, 2007 4:35 am

yeah it seems there is problem with code...[img]C:\Documents and Settings\Ashwani\Desktop\cute_kitty2.jpg[/img]

User avatar
MasterZ
Registered User
Posts: 712
Joined: Wed Sep 24, 2003 5:33 am
Contact:

Re: phpbb3 youtube/google video BBCODE

Post by MasterZ » Sun May 06, 2007 6:05 am

you can't post a link to an image on your hard drive, you must upload it to the internet somewhere and link to it there.

User avatar
Lastof
Registered User
Posts: 743
Joined: Fri Feb 13, 2004 7:29 pm
Location: UK
Contact:

Re: phpbb3 youtube/google video BBCODE

Post by Lastof » Sun May 06, 2007 11:53 am

MasterZ wrote: you can't post a link to an image on your hard drive, you must upload it to the internet somewhere and link to it there.


There is also the shiny new attachment feature.
Last edited by Lastof on 04 May 2011, 00:00, edited -1 times in total
----------------------------------------------------------------------------------------------------------------------------------------
Image
Look, I'm officially not a bug!!

User avatar
MasterZ
Registered User
Posts: 712
Joined: Wed Sep 24, 2003 5:33 am
Contact:

Re: phpbb3 youtube/google video BBCODE

Post by MasterZ » Sun May 06, 2007 1:00 pm

Lastof wrote:
MasterZ wrote: you can't post a link to an image on your hard drive, you must upload it to the internet somewhere and link to it there.


There is also the shiny new attachment feature.


awww, yes, I forgot about that....phpBB thinks of almost everything :)

User avatar
rickyreter40
Registered User
Posts: 105
Joined: Tue Aug 01, 2006 7:56 pm
Location: sussex

Re: phpbb3 youtube/google video BBCODE

Post by rickyreter40 » Thu May 24, 2007 3:32 pm

wctin wrote:i made a little bbcode sample for youtube/google video

What this does is allow users to embed youtube or google videos in their posts without having to let full access to flash..

additionally it will remove the "click here to activate this control" message that internet explorers experience when flash is embed on their page..

first add a new bbcode as follows for google

Code: Select all

[google]{text}[/google]
Next add the html replacement for the google bbcode

Code: Select all

<script>
swfg("{text}");
</script>
now add a new bbcode as follows for youtube

Code: Select all

[youtube]{text}[/youtube]
Next add the html replacement for the youtube bbcode

Code: Select all

<script>
swfy("{text}");
</script>
Now finally save the following as "video.js" and point to it in your overall header template like this
<script src=http://yoursite.com/video.js></script>

Code: Select all

function swfg(URL)
{

document.write('<embed src="http://video.google.com/googleplayer.swf?docId=' + URL + '" wmode="transparent" style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" flashvars=""></embed>');

}
function swfy(URL)
{

document.write('<embed src="http://www.youtube.com/v/' + URL + '" wmode="transparent" style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" flashvars=""></embed>');

}

If you would like to have the youtube videos "autostart" like they do on the youtube site you can add "autoplay=1" to the flashvars in the js file if you want the video to autostart and loop try "autostart=1&loop=1"

so even if you have flash turned on by default you may still want to use this code to have youtube videos loop or autostart , bypassing the default method of NOT looping and NOT autostarting.

p.s. in the hints tab of the bbcode you may want explain that they only need to insert the "ID" of the video not the complete url

someone may want to edit the js file to include other popular video sites,

Hi,sorry for being thick ,i've done the bbcodes but where do i put that other code to in header...can you go a nother step and help.

Peter
http://www.cartalkuk.co.uk
Join for free....carchat...

User avatar
fadirocks
Registered User
Posts: 42
Joined: Wed Apr 06, 2005 10:01 pm
Location: Boston
Contact:

Re: phpbb3 youtube/google video BBCODE

Post by fadirocks » Sat May 26, 2007 9:05 pm

Here is my easy way :)

for google

BBCode usage:

Code: Select all

[google={URL}videoplay?docid={TEXT}]{TEXT2}[/google]
HTML replacement:

Code: Select all

<b>{TEXT2}</b><br>
<embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId={TEXT}"><br><a href="{URL}videoplay?docid={TEXT}" target="_blank">Source</a>
Help Line:

Code: Select all

Usage [google=http://URL]Title[/google]
Settings:
Display on posting page "checked"



for youtube

BBCode usage:

Code: Select all

[youtube={URL}watch?v={TEXT}]{TEXT2}[/youtube]
HTML replacement:

Code: Select all

<b>{TEXT2}</b><br>
<embed style="width:400px; height:326px;" src="http://www.youtube.com/v/{TEXT}"<br>
<a href="{URL}watch?v={TEXT}" target="_blank">Source</a>
Help Line:

Code: Select all

Usage [youtube=http://URL]Title[/youtube]
Settings:
Display on posting page "checked"


very simple to do no need to edit anything else!

User avatar
rickyreter40
Registered User
Posts: 105
Joined: Tue Aug 01, 2006 7:56 pm
Location: sussex

Re: phpbb3 youtube/google video BBCODE

Post by rickyreter40 » Sun May 27, 2007 12:18 am

Thanks mann
http://www.cartalkuk.co.uk
Join for free....carchat...

User avatar
Frodosringfinger
Registered User
Posts: 226
Joined: Mon Oct 16, 2006 1:45 am
Location: Maryland
Contact:

Re: phpbb3 youtube/google video BBCODE

Post by Frodosringfinger » Sun May 27, 2007 12:29 am

Check this topic:
http://www.phpbb.com/community/viewtopi ... 4&t=546007
Its the easiest way.
Lets you just use the simple embed code thats on every youtube and google video page.

User avatar
Techie-Micheal
Security Consultant
Posts: 19510
Joined: Sun Oct 14, 2001 12:11 am
Location: In your servers

Re: phpbb3 youtube/google video BBCODE

Post by Techie-Micheal » Sun May 27, 2007 6:01 pm

Why is this important? phpBB has a flash BBCode.
Proven Offensive Security Expertise. OSCP - GXPN

User avatar
Frodosringfinger
Registered User
Posts: 226
Joined: Mon Oct 16, 2006 1:45 am
Location: Maryland
Contact:

Re: phpbb3 youtube/google video BBCODE

Post by Frodosringfinger » Sun May 27, 2007 6:21 pm

[flash=][/flash]

I cant figure out how to use that...
videos wont embed with that. simple flash game embeds wont either. I think im using it wrong

User avatar
Techie-Micheal
Security Consultant
Posts: 19510
Joined: Sun Oct 14, 2001 12:11 am
Location: In your servers

Re: phpbb3 youtube/google video BBCODE

Post by Techie-Micheal » Sun May 27, 2007 6:58 pm

You'll want to do

Code: Select all

[flash=x,y]url[/flash]
As an example, from Youtube:



Which uses this:

Code: Select all

[flash=425,350]http://www.youtube.com/v/neAiLZcy8Qk[/flash]
Proven Offensive Security Expertise. OSCP - GXPN

User avatar
fadirocks
Registered User
Posts: 42
Joined: Wed Apr 06, 2005 10:01 pm
Location: Boston
Contact:

Re: phpbb3 youtube/google video BBCODE

Post by fadirocks » Sun May 27, 2007 7:18 pm

Techie-Micheal wrote:You'll want to do

Code: Select all

[flash=x,y]url[/flash]
As an example, from Youtube:

...

Which uses this:

Code: Select all

[flash=425,350]http://www.youtube.com/v/neAiLZcy8Qk[/flash]
well that's nice for somebody who knows what he/she is doing but how about for the common folks?
also how about if flash posting disabled on the forums but still want to have yahoo and google vids posted?

wctin
Registered User
Posts: 3
Joined: Sat May 05, 2007 7:00 pm

Re: phpbb3 youtube/google video BBCODE

Post by wctin » Mon May 28, 2007 9:08 am

SHS` wrote:phpBB3's setting for allow Flash (as in via the BBCode [flash]) is a completely different setting and doesn't effect custom BBCodes.
exactly , thats why i invented this :)
SHS` wrote: Secondly, usage of <embed> is invalid XHTML 1.0 Strict (2nd Edition), even if content is inserted via Javascript.
good point ..

it works in 99% of browsers

I made this for 2 reasons that arent available thru the regular codes/config

#1 so you could allow only flash to be used from youtube or google

#2 so you could have the youtube videos play onload and loop

Locked

Return to “phpBB Discussion”

Who is online

Users browsing this forum: No registered users and 20 guests

cron