views:

2187

answers:

3

I want my SWF to autoplay in a Facebook profile box. I am currently using an FBML based app but I am open to using any type that would make this easy. Using the param waitforclick=false does not work in the profile box so this is not an option.

At first I thought this would not be possible without using an AJAX request (that is what the docs say) but after trying to do this via AJAX with no luck, I did a bit more research. I found that in the ReverbNation facebook application "My Band", they are able to autoplay a SWF. I haven't quite figured out how they do it yet but I did take a look at the generated profile box code before clicking the SWF and after clicking the SWF.

Before clicking:

<div id="2405167945_fbswf_4b0b4cce045f91534648943" height="15" width="15" overflow="hidden" class="__fbswf">
 <embed type="application/x-shockwave-flash"    src="http://cache.reverbnation.com/widgets/content/player/facebookOneShot.swf?emailPlaylist=song_2509346&amp;amp;autoPlay=true" 
  style="" id="swf_4b0b4cce049094f82894993" name="swf_4b0b4cce049094f82894993" bgcolor="000000" quality="high" 
  allowscriptaccess="never" fbjs="_id_4b0b4cce046032577161862" wmode="transparent"  flashvars="=&amp;fb_local_connection=_id4b0b4cce046320307815032&amp;fb_fbjs_connection=_id_4b0b4cce046032577161862&amp;fb_sig_profile=527222885&amp;fb_sig_locale=en_US&amp;fb_sig_in_new_facebook=1&amp;fb_sig_time=1259031758.018&amp;fb_sig_added=1&amp;fb_sig_profile_update_time=1239997072&amp;fb_sig_expires=1259038800&amp;fb_sig_user=527222885&amp;fb_sig_session_key=2.FMzt5_mR_LhrqF4nrQLhcg__.3600.1259038800-527222885&amp;fb_sig_ss=gAOI6rA0R_2tlubA5ahK_g__&amp;fb_sig_cookie_sig=2431e415604aec8066fce75f39769356&amp;fb_sig_ext_perms=auto_publish_recent_activity&amp;fb_sig_api_key=c3759de5d7120d6acc4dae494d1928be&amp;fb_sig_app_id=2405167945&amp;fb_sig=4cd04d06aae5296914b98fbae724b2cf&amp;string_table=http://static.ak.fbcdn.net/js_strings.php/t87432/en_US&amp;amp;swf_id=swf_4b0b4cce049094f82894993" 
  width="15" height="15">
</div>

After clicking:

<div id="2405167945_fbswf_4b0b4d42660ba6dbafc86" height="15" width="15" overflow="hidden" class="__fbswf">
 <a height="15" width="15" waitforclick="true" 
 swfsrc="http://cache.reverbnation.com/widgets/content/player/facebookOneShot.swf?emailPlaylist=song_2509346&amp;amp;autoPlay=true" 
 imgclass="rn_button_play_even" 
 imgsrc="http://cache.reverbnation.com/images/facebook/spacer.gif" 
 onclick="swf_4b0b4d426c7a777aed2e2 = new 
 SWFObject("http://cache.reverbnation.com/widgets/content/player/facebookOneShot.swf?emailPlaylist=song_2509346\x26autoPlay=true", 
 "swf_4b0b4d426c7a777aed2e2", 
 "15", "15", ["9.0.159.0","10.0.22.87"], "000000");
swf_4b0b4d426c7a777aed2e2.addParam("allowScriptAccess", "never");
swf_4b0b4d426c7a777aed2e2.addParam("fbjs", "_id_4b0b4d42660c73d7dd160");
swf_4b0b4d426c7a777aed2e2.addParam("wmode", "transparent");
swf_4b0b4d426c7a777aed2e2.addVariable("", "");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_local_connection", "_id4b0b4d42699b33975134d");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_fbjs_connection", "_id_4b0b4d42660c73d7dd160");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_profile", "527222885");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_locale", "en_US");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_in_new_facebook", "1");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_time", "1259031874.4381");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_added", "1");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_profile_update_time", "1239997072");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_expires", "1259038800");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_user", "527222885");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_session_key", "2.FMzt5_mR_LhrqF4nrQLhcg__.3600.1259038800-527222885");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_ss", "gAOI6rA0R_2tlubA5ahK_g__");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_cookie_sig", "2431e415604aec8066fce75f39769356");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_ext_perms", "auto_publish_recent_activity");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_api_key", "c3759de5d7120d6acc4dae494d1928be");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig_app_id", "2405167945");
swf_4b0b4d426c7a777aed2e2.addVariable("fb_sig", "cd50d9ce65cfdac0100fd445fb041e9d");
swf_4b0b4d426c7a777aed2e2.addVariable("string_table", "http://static.ak.fbcdn.net/js_strings.php/t87432/en_US");
swf_4b0b4d426c7a777aed2e2.addVariable("swf_id", "swf_4b0b4d426c7a777aed2e2");
swf_4b0b4d426c7a777aed2e2.fallback_html = "\x3cdiv class=\x22flash_fallback\x22\x3e\x3cdiv class=\x22flash_fallback_border\x22\x3e\x3cdiv class=\x22flash_fallback_header\x22\x3eFlash Player upgrade required\x3c/div\x3e\x3cdiv class=\x22flash_fallback_explanation\x22 id=\x22flash_fallback_4b0b4d426c8fc1a1c5deb\x22\x3eYou must download and install the latest version of the Adobe Flash Player to view this content.\x3c/div\x3e\x3cdiv class=\x22flash_fallback_button\x22\x3e\x3cinput type=\x22button\x22 class=\x22inputbutton\x22 onclick=\x22this.disabled=true;getFlashPlayer();\x22 id=\x22\x22 name=\x22\x22 value=\x22Download Flash\x22 /\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e";
swf_4b0b4d426c7a777aed2e2.write("2405167945_fbswf_4b0b4d42660ba6dbafc86");; (new Image()).src = '/ajax/ct.php?app_id=2405167945&amp;action_type=5&amp;post_form_id=957a92c32bf2dda6d7c4e508685c3718&amp;position=2&amp;' + Math.random(); return false;" href="#" flash="true"><img src="http://platform.ak.fbcdn.net/www/app_full_proxy.php?app=2405167945&amp;amp;v=1&amp;amp;size=p&amp;amp;cksum=57619dca4b62f0b11a83d8c46cf2decd&amp;amp;src=http%3A%2F%2Fcache.reverbnation.com%2Fimages%2Ffacebook%2Fspacer.gif" class="rn_button_play_even" width="15" height="15"></a></div>

Does anyone know how to make this autoplay feature happen? I am really having trouble finding documentation anywhere on the internet. I am also really not sure why the generated code changes to SWFObject code after clicking.

Thanks!

+1  A: 

Looks like its being passed as a flash param with their implementation:

src="http://cache.reverbnation.com/widgets/content/player/facebookOneShot.swf?emailPlaylist=song_2509346&amp;amp;autoPlay=true"

How this is being implemented on their end i have no idea though.

prodigitalson
That parameter seems to have no effect the SWF
Tony
Well its not going ot have an effect on YOUR swf - thats a paramer the SWF uses internally - or possibly that they JS is using somehow. Like i said - it looks like thats what they are using to flag autoplay - how they have actually implemented it on their end I dont know.
prodigitalson
if i go to the URL of THEIR SWF with and without that param it auto plays. not sure if that param only affects the SWF when it is embedded in fbook though. either way, the SWF cannot control this internally according to facebook docs. It has to be some FBJS or facebook related nuance that I haven't figured out.
Tony
This works fine on what I was trying to do. Thanks a lot !
marcgg
A: 

I am not going to waste my time figuring this out since it looks like profile boxes are going away soon: http://wiki.developers.facebook.com/index.php/Roadmap%5FProfile

Tony
A: 

Don't make it auto-play. That's the obnoxious behavior that gives Flash apps a bad reputation. I think Facebook specifically disallows auto-play, or takes steps to block it. I could be wrong.

"Hey, you and everyone else within earshot are gonna LOVE this song!"

Broam
autoplay does not imply playing music. i would never do that. the reason i want my SWF to autoplay is that it is a mailing list sign up widget. the flex widget displays a custom user interface depending on the user. it can only load the custom user interface when it is activated and therefore i cannot accurately display a screen shot of the widget before it loads
Tony
What makes this require flash over, say, a simple HTTP POST form?
Broam
the UI is really nice on the flash widget and keeping it in flash will allow me to maintain one UI for this widget. however, autoplay just isn't possible so it looks like I am going to be coding an HTML widget as well :(
Tony
-1 this is an opinion, not an answer...
marcgg

related questions