Adding Flash or Youtube Video Using FBML
To embed a hosted Flash file or YouTube video to an FBML application or Static FBML tab, you must use the FBML code. Regular HTML embed code will not work. Fortunately, the FBML code is actually simpler and less confusing than standard embed code.
fb:swf and fb:flv
The two primary tags you would use to embed video or Flash files are <fb:swf> and <fb:flv>. Although they are very similar, it’s important to figure out which of the two are appropriate for your situation.
If you’re embedding a video from YouTube, or if you’re hosting your own swf file, use <fb:swf>.
Example:
<fb:swf swfbgcolor="000000" imgstyle="border-width:3px; border-color:white;" swfsrc='http://www.youtube.com/v/xxxxxxxxxx' imgsrc='http://img.youtube.com/vi/xxxxxxxxxx/2.jpg' width='340' height='270' />
Embedding a YouTube Video
In the example above, the xxxxxxxxx is a placeholder for the YouTube video ID. You can obtain this video ID by looking at the url of the video on YouTube.
In the url http://www.youtube.com/watch?v=-CVYOCMpJRY, we can see by the url that the video ID is -CVYOCMpJRY.
The string of text immediately following the v= in a YouTube url is the video ID, and this is what you use in place of xxxxxxx in the example.
You’ll notice a parameter called imgsrc in the code example. This specifies what static image you wish to display when the video is loaded but has not been played yet. YouTube automatically generates static images based off the uploaded video, so you can use one of their, or upload your own and specify the url to that image in the imgsrc parameter.
To embed your own swf file, simply swap out the entire swfsrc and imgsrc values above with the url to your own files. While most of the other parameters are self-explanatory, and deal with background colors, size and and borders, you can check out the full documentation on fb:swf for more detail.
Embedding an flv file
If you need to embed an .flv file, facebook provides FBML for that as well. Although this code is arguably not used as often as <fb:swf>, <fb:flv> can be very useful.
Example:
<fb:flv src='http://www.mediacollege.com/video-gallery/testclips/barsandtone.flv' width='400' height='300' title='my movie' color='#FFBB00' salign='r' img='http://www.example.com/test.jpg' scale='showall'/ >
Again, the additional parameters are fairly self-explanatory, but you can find the documentation here.








Pingback: Using JW Player in FBML to Bypass YouTube Video Ads | FBMHell.Com