13 Ocak 2008 Pazar

How to Play YouTube-Style Flash Videos in Facebook

Displaying Flash videos, such as those found on YouTube, Metacafe, or CollegeHumor, is usually a simple task thanks to the readily available “embed code” provided by these websites. However, in order to ensure that embedded Flash media enforces site standards both internally and on developers’ applications, animations must be sanitized with one of several FBML tags, adding a bit of complication to the mix.

Normally, embed code on a site like YouTube can be copied in a format similar to the following. (Note that the below HTML is typically displayed as a single condensed line of code; however, it has been split into multiple lines here to improve readability.)




type="application/x-shockwave-flash"
wmode="transparent"
width="425" height="355">


In order to display this same video in a Facebook canvas page, however, the FBML tag fb:swf must be used.

Getting started with the basic fb:swf usage is relatively simple. The only required attribute is “swfsrc”, which defines the remote location from which the Flash file will be loaded. For rendering YouTube videos, the value of this attribute must be set to the object parameter value whose name is “movie” from the provided embed code. Using the above example, swfsrc must be set to “http://www.youtube.com/v/dMH0bHeiRNg&rel=1″. With this, the FBML output should appear as follows.

Hiç yorum yok: