right now i m using
this code for playing youtube videos
<?php
// Replace Youtube URLs with embed code
function embedYoutube($text)
{
$search = '% # Match any youtube URL in the wild.
(?:https?://)? # Optional scheme. Either http or https
(?:www\.)? # Optional www subdomain
(?: # Group host alternatives
youtu\.be/ # Either youtu.be,
| youtube\.com # or youtube.com
(?: # Group path alternatives
/embed/ # Either /embed/
| /v/ # or /v/
| /watch\?v= # or /watch\?v=
) # End path alternatives.
) # End host alternatives.
([\w\-]{10,12}) # Allow 10-12 for 11 char youtube id.
\b # Anchor end to word boundary.
%x';
$replace = '<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/$1?fs=1"</param>
<param name="allowFullScreen" value="true"></param>
<param name="allowScriptAccess" value="always"></param>
<embed src="http://www.youtube.com/v/$1?fs=1"
type="application/x-shockwave-flash" allowscriptaccess="always" width="425" height="344">
</embed>
</object>';
return preg_replace($search, $replace, $text);
}
$string = 'This is the forum post content with some Youtube links:'."\n".
'http://www.youtube.com/watch?v=NLqAF9hrVbY'."\n".
'http://www.youtube.com/v/u1zgFlCw8Aw?fs=1&hl=en_US';
echo embedYoutube($string);
?>
but these videos can’t be played in full screen mode as well as these embedded code doesn’t show any info of the video or from where it was taken.
eg. http://www.youtube.com/watch?v=YR12Z8f1Dh8
show video with full screen option
with title
Why This Kolaveri Di Full Song Promo Video in HD
youtube.com
and description like
Chinna Surprise
Check out this exclusive video shot during the recording of the song with the music composer Anirudh,Dhanush,Shruti Hassan, Aishwarya and Sound Engineer Sivakumar
something like as facebook does.
How, to do it any one have any answer.
Try,
allowFullScreen="true"in yourembedattributesFor getting the other video info like
descriptionyou have to use youtube data api,Reference Guide: Data API Protocol
You can fetch the info from your server side using
curl.