Camen Design Forum

embedd youtube videos?

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

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

Only the original author or a moderator can append to this post.

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

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn