Flash 视频未出现在 Facebook 画布页面上
该页面在本地请求时工作(播放 Flash 电影), http://localhost:8080/flash.aspx
我还设置了 url 路由 http://localhost:8080/videos/ 也指向 http://localhost:8080/flash.aspx
如果我设置了以下 facebook 应用程序设置:
- --website---
- 站点 url: http://localhost:8080/
- 站点域:localhost
---facebook 集成---
当我请求页面时: http://apps.facebook.com/my_app - http://localhost:8080/flash.aspx 已加载到 facebook 画布中(我可以看到我的测试文本), 但是,Flash 影片无法播放。
这是我用来在 flash.aspx 上加载 swf 的 jquery 代码
$(document).ready(function () {
if (swfobject.hasFlashPlayerVersion("6.0.0")) {
var att = { data: "flash/video.swf", width: "385", height: "312" };
var par = { flashvars: "foo=bar" };
var id = "video-container";
swfobject.createSWF(att, par, id);
}
});
任何想法为什么当我请求时 Flash 电影不播放: http://apps.facebook.com/my_app/ 但在页面打开时确实可以正常播放本地请求?
this page works when requested locally (a flash movie plays),
http://localhost:8080/flash.aspx
I also have url routing set up
http://localhost:8080/videos/ also directs to
http://localhost:8080/flash.aspx
If I have set up the following facebook application settings:
---website---
- site url: http://localhost:8080/
- site domain: localhost
---facebook integration---
- canvas page: http://apps.facebook.com/my_app/
- canvas url: http://localhost:8080/video/
when I request the page: http://apps.facebook.com/my_app -
http://localhost:8080/flash.aspx is loaded into the facebook canvas (I can see my testing text),
however, the flash movie does not play.
Here is the jquery code I'm using to load the swf on flash.aspx
$(document).ready(function () {
if (swfobject.hasFlashPlayerVersion("6.0.0")) {
var att = { data: "flash/video.swf", width: "385", height: "312" };
var par = { flashvars: "foo=bar" };
var id = "video-container";
swfobject.createSWF(att, par, id);
}
});
Any ideas why the flash movie isn't playing when I request:
http://apps.facebook.com/my_app/ but does play as it should when the page is requested locally?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Flash 文件的绝对路径修复了该问题。 http://www.mysite.com/flash/video.swf
Using an absolute path to the flash file fixed it. http://www.mysite.com/flash/video.swf
我不知道域问题(这些问题超出了 SWFObject 的范围),但您的代码可以稍微改进一下。您将整个块包装在 jQuery
ready
函数中,但随后您还使用了 addDomLoadEvent。这是多余的。您可以简化为:或者您可以只使用 SWFObject 的
embedSWF
函数,该函数内置了 domload 检测:I don't know about the domain issues (those are outside the scope of SWFObject), but your code can be improved a little. You're wrapping the entire block in a jQuery
ready
function, but then you also use the addDomLoadEvent. This is redundant. You can simplify to:OR you could just use SWFObject's
embedSWF
function, which has domload detection built-in: