I’ve been using youtube bracket for wp for long time.

Based on that Idea I isolated it to make it work at any installation.

This script allows you to write anywhere in your content this and will return a flash player with the video embed.

Function that embeds the flash in the content:

$content=mediaPostDesc($content);//usage
 
function mediaPostDesc($the_content){//from a description add the media
//using http://www.robertbuzink.nl/journal/2006/11/23/youtube-brackets-wordpress-plugin/
    if (VIDEO){
        $stag = "[youtube=http://www.youtube.com/watch?v=";
        $etag = "]";
        $spos = strpos($the_content, $stag);
        if ($spos !== false){
            $epos = strpos($the_content, $etag, $spos);
            $spose = $spos + strlen($stag);
            $slen = $epos - $spose;
            $file  = substr($the_content, $spose, $slen);    
			//youtube
            $tags = '<object width="425" height="350">
                    <param name="movie" value="'.$file.'"></param>
                    <param name="wmode" value="transparent" ></param>
                    <embed src="http://www.youtube.com/v/'. $file.'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
                    </object>';    
            $new_content = substr($the_content,0,$spos);
            $new_content .= $tags;
            $new_content .= substr($the_content,($epos+1));
 
            if ($epos+1 < strlen($the_content)) {//reciproco
                $new_content = mediaPostDesc($new_content);
            }
            return $new_content;
        }
        else return $the_content;
    }
    else return $the_content;
}

But if we allow users to insert this code, why not make it easier to them?

HTML that we need, to previsualize the video:

<span style="cursor:pointer;" onclick="youtubePrompt();">Youtube Video</span>: <br />
<input id="video" name="video" type="text" value="" onclick="youtubePrompt();" size="40" /><br />
<div id="youtubeVideo"></div>

JavaScript to insert youtube URL:

function youtubePrompt(){
    vurl=prompt('Youtube.com URL','http://www.youtube.com/watch?v=XXXXXXX');
    if(vurl.indexOf("http://www.youtube.com/watch?v=")==0){
        document.getElementById('video').value=vurl;
        file=vurl.substr(31,vurl.length);
        tags = "<object width=\"425\" height=\"350\"><param name=\"movie\" value=\""+file+"\"></param><param name=\"wmode\" value=\"transparent\" ></param><embed src=\"http://www.youtube.com/v/"+file+"\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed> </object>"; 
        document.getElementById('youtubeVideo').innerHTML=tags;
    }
    else {
         document.getElementById('video').value="";
         document.getElementById('youtubeVideo').innerHTML="";
    }
}

Example of php code to insert it in our content:

if (strpos($_POST["video"], "http://www.youtube.com/watch?v=")==0) $desc.='[youtube='.$_POST["video"].']';//youtube video
// then insert in DB

This feature it is already planned for OC 1.6.3 ;)