Camen Design Forum

embedd youtube videos?

append delete Stephen

is there anyway to embedd a youtube video into a post for my forum?. as it would be cool to alow pepole post to add videos. its cool how you can post a link and it hyperlinks it thats awsome. but i am just wondering is there anyway to embedd the video?. :) thanks!

Reply RSS

Replies

append delete #1. Kroc

Is there a way? Currently, no. Is there a way to add it? Yes, anything is possible with programming. One could modify the code to find youtube links and convert them into embedded videos.

NNF doesn't embed pictures or videos because of easy abuse by anonymous users. One your forum, do you expect the public to be posting videos, or your moderators? It wouldn't be unrealistic to allow moderators to embed pictures and videos, and I would consider that feature, but it's not sensible to allow anonymous users to do that.

append delete #2. Johann

here's something I made for myself a while ago, it should be a starting point, at least better than nothing (it's up to you to figure out how to plug it into NNF though ^^)..

%
	$return = preg_replace (array(
		'/\[VIDEO\]http(.+?)youtube(.+?)\/watch\?v=(...........)(.*?)\[\/VIDEO\]/si',
		'/\[VIDEO\]http(.+?)youtu\.be\/(...........)(.*?)\[\/VIDEO\]/si',
		'/\[VIDEO\](.+?)vimeo\.com\/([0-9]+?)\[\/VIDEO\]/si',
		'/\[VIDEO\](.+?)screen\.yahoo\.com\/(.+?)-([0-9]+?)\.html\[\/VIDEO\]/si',
		'/\[VIDEO\](.+?)video\.google\.com\/videoplay\?docid=(.+?)&(.+?)\[\/VIDEO\]/si',
	), array(
		'<object width=100% height=300><param name=movie value=http://www.youtube-nocookie.com/v/\3?version=3&amp;hl=en_US&amp;rel=0 /><param name=allowFullScreen value=true /><param name="wmode" value=transparent /><param name=allowscriptaccess value=always /><embed src=http://www.youtube-nocookie.com/v/\3?version=3&amp;hl=en_US&amp;rel=0 type=application/x-shockwave-flash width=100% height=300 allowscriptaccess=always allowfullscreen=true wmode=transparent></embed></object>',
		'<object width=100% height=300><param name=movie value=http://www.youtube-nocookie.com/v/\2?version=3&amp;hl=en_US&amp;rel=0 /><param name=allowFullScreen value=true /><param name="wmode" value=transparent /><param name=allowscriptaccess value=always /><embed src=http://www.youtube-nocookie.com/v/\2?version=3&amp;hl=en_US&amp;rel=0 type=application/x-shockwave-flash width=100% height=300 allowscriptaccess=always allowfullscreen=true wmode=transparent></embed></object>',
		'<iframe src="http://player.vimeo.com/video/\2?title=1&amp;byline=1" width="100%" height="300" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
		'<iframe frameborder="0" width="100%" height="300" src="http://d.yimg.com/nl/vyc/site/player.html#vid=\3&lang=en-US"></iframe>',
		'<embed src=http://video.google.com/googleplayer.swf?docid=\2&hl=en&fs=true style=width:100%;height:300px allowFullScreen=true allowScriptAccess=always type=application/x-shockwave-flash></embed>',
	), $return);
%

I hope this shows up correctly :/ Otherwise feel free to edit/delete.

Yes, you can break a forum by posting huge images. But when it comes to videos, personally I actually prefer the video still thumbnail than a cryptic link which automatically plays the video when visiting it, I consider that less annoying... anyway, if anyone wanted to crap over a NNF installation, there is nothing stopping them, so the reasons people don't do it aren't technical ones. Just a thought or something :)

append delete #3. Johann

Oh, I forgot to mention, that the above snippet expects the links inside of [video] tags -- you might want to remove those bits from the beginning and end depending on your use.

append delete #4. Kroc

Nice code example Johann, that would be very easy to plug in to the `formatText` function :)

append delete #5. Johann

Cheers :) I'm not that good with regexes, so there's likely to be room for improvement, but it worked nicely for me so far. By now I kinda prefer that over pasting embed codes, even in my own pages, because it allows for to tweaking all embed codes in one fell swoop. I'll probably never "need" that, but it just feels good haha ^^

append delete #6. Stephen

Hey guys thanks so much for ur cool replys its cool it looks really nice with just the links. as i have a gamer thread on sleeping dogs for ps3 and xbox360. And i wanted links to the videos on youtube but it looks really sweet with the links and they are clickable automaticly so its cool.

Thanks guys!!!

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Kroc, Impressed, theraje, Martijn