如何在 Facebook 应用程序的个人资料框中自动播放 SWF?
我希望我的 SWF 在 Facebook 个人资料框中自动播放。我目前正在使用基于 FBML 的应用程序,但我愿意使用任何能让这变得简单的类型。使用参数 waitforclick=false 在配置文件框中不起作用,因此这不是一个选项。
起初,我认为如果不使用 AJAX 请求(文档就是这么说的),这是不可能的,但在尝试通过 AJAX 执行此操作但没有成功后,我做了更多研究。我发现在 ReverbNation Facebook 应用程序“My Band”中,他们能够自动播放 SWF。我还没有完全弄清楚他们是如何做到这一点的,但我确实在单击 SWF 之前和单击 SWF 之后查看了生成的配置文件框代码。
单击之前:
<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&autoPlay=true"
style="" id="swf_4b0b4cce049094f82894993" name="swf_4b0b4cce049094f82894993" bgcolor="000000" quality="high"
allowscriptaccess="never" fbjs="_id_4b0b4cce046032577161862" wmode="transparent" flashvars="=&fb_local_connection=_id4b0b4cce046320307815032&fb_fbjs_connection=_id_4b0b4cce046032577161862&fb_sig_profile=527222885&fb_sig_locale=en_US&fb_sig_in_new_facebook=1&fb_sig_time=1259031758.018&fb_sig_added=1&fb_sig_profile_update_time=1239997072&fb_sig_expires=1259038800&fb_sig_user=527222885&fb_sig_session_key=2.FMzt5_mR_LhrqF4nrQLhcg__.3600.1259038800-527222885&fb_sig_ss=gAOI6rA0R_2tlubA5ahK_g__&fb_sig_cookie_sig=2431e415604aec8066fce75f39769356&fb_sig_ext_perms=auto_publish_recent_activity&fb_sig_api_key=c3759de5d7120d6acc4dae494d1928be&fb_sig_app_id=2405167945&fb_sig=4cd04d06aae5296914b98fbae724b2cf&string_table=http://static.ak.fbcdn.net/js_strings.php/t87432/en_US&swf_id=swf_4b0b4cce049094f82894993"
width="15" height="15">
</div>
单击之后:
<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&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&action_type=5&post_form_id=957a92c32bf2dda6d7c4e508685c3718&position=2&' + Math.random(); return false;" href="#" flash="true"><img src="http://platform.ak.fbcdn.net/www/app_full_proxy.php?app=2405167945&v=1&size=p&cksum=57619dca4b62f0b11a83d8c46cf2decd&src=http%3A%2F%2Fcache.reverbnation.com%2Fimages%2Ffacebook%2Fspacer.gif" class="rn_button_play_even" width="15" height="15"></a></div>
有谁知道如何实现此自动播放功能?我真的很难在互联网上的任何地方找到文档。我也真的不确定为什么生成的代码在单击后会更改为 SWFObject 代码。
谢谢!
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&autoPlay=true"
style="" id="swf_4b0b4cce049094f82894993" name="swf_4b0b4cce049094f82894993" bgcolor="000000" quality="high"
allowscriptaccess="never" fbjs="_id_4b0b4cce046032577161862" wmode="transparent" flashvars="=&fb_local_connection=_id4b0b4cce046320307815032&fb_fbjs_connection=_id_4b0b4cce046032577161862&fb_sig_profile=527222885&fb_sig_locale=en_US&fb_sig_in_new_facebook=1&fb_sig_time=1259031758.018&fb_sig_added=1&fb_sig_profile_update_time=1239997072&fb_sig_expires=1259038800&fb_sig_user=527222885&fb_sig_session_key=2.FMzt5_mR_LhrqF4nrQLhcg__.3600.1259038800-527222885&fb_sig_ss=gAOI6rA0R_2tlubA5ahK_g__&fb_sig_cookie_sig=2431e415604aec8066fce75f39769356&fb_sig_ext_perms=auto_publish_recent_activity&fb_sig_api_key=c3759de5d7120d6acc4dae494d1928be&fb_sig_app_id=2405167945&fb_sig=4cd04d06aae5296914b98fbae724b2cf&string_table=http://static.ak.fbcdn.net/js_strings.php/t87432/en_US&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&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&action_type=5&post_form_id=957a92c32bf2dda6d7c4e508685c3718&position=2&' + Math.random(); return false;" href="#" flash="true"><img src="http://platform.ak.fbcdn.net/www/app_full_proxy.php?app=2405167945&v=1&size=p&cksum=57619dca4b62f0b11a83d8c46cf2decd&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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来它是作为 flash 参数传递给它们的实现的:
不过我不知道它们是如何实现的。
Looks like its being passed as a flash param with their implementation:
How this is being implemented on their end i have no idea though.
值得注意的是,虽然 Facebook 取消了向“个人资料”页面添加选项卡的功能,但您仍然可以将它们添加到“粉丝”页面。这将继续得到支持。您如何知道您拥有哪种类型的页面?好吧,如果有人可以加你为好友,你就有了一个个人资料页面;如果有人可以喜欢你,那么你就有了一个粉丝页面。
ReverbNation MyBand 应用程序不使用基本的 FBML 选项卡方法...它是一个更强大的画布应用程序。根据开发文档,在 FBML 中,出于“安全和美观原因”,自动播放被禁用。如果您想解决此问题,请创建一个画布应用程序,以便您可以进行必要的 AJAX 调用。
http://developers.facebook.com/docs/reference/fbml/swf/
It's notable that while Facebook has done away with the ability to add tabs to PROFILE pages, you can still add them to FAN pages. This continues to be supported. How do you know which kind of page you have? Well, if someone can friend you, you have a PROFILE page; if someone can LIKE you, then you have a FAN page.
The ReverbNation MyBand app doesn't use a basic FBML tab approach... it's a more robust canvas app. In FBML, Auto play is disabled for "security and aesthetic reasons", according to the Dev Docs. If you want to work around this, create a canvas app, so that you can make the necessary AJAX call.
http://developers.facebook.com/docs/reference/fbml/swf/