Flash 视频未出现在 Facebook 画布页面上

发布于 2024-11-17 19:45:42 字数 1545 浏览 2 评论 0原文

该页面在本地请求时工作(播放 Flash 电影), http://localhost:8080/flash.aspx

我还设置了 url 路由 http://localhost:8080/videos/ 也指向 http://localhost:8080/flash.aspx

如果我设置了以下 facebook 应用程序设置:

- --website---

  1. 站点 url: http://localhost:8080/
  2. 站点域:localhost

---facebook 集成---

  1. 画布页面:http://apps.facebook.com/my_app/
  2. 画布网址:http://localhost:8080/video/

当我请求页面时: 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---

  1. site url: http://localhost:8080/
  2. site domain: localhost

---facebook integration---

  1. canvas page: http://apps.facebook.com/my_app/
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼藏柔 2024-11-24 19:45:42

使用 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

一曲琵琶半遮面シ 2024-11-24 19:45:42

我不知道域问题(这些问题超出了 SWFObject 的范围),但您的代码可以稍微改进一下。您将整个块包装在 jQuery ready 函数中,但随后您还使用了 addDomLoadEvent。这是多余的。您可以简化为:

$(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";
        var myObject = swfobject.createSWF(att, par, id);
    }
 });

或者您可以只使用 SWFObject 的 embedSWF 函数,该函数内置了 domload 检测:

var flashvars = { foo: "bar" };
var par = {};
var att = {};
swfobject.embedSWF("flash/video.swf", "video-container", "385", "312", "6.0.0", false, flashvars, par, att);

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:

$(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";
        var myObject = swfobject.createSWF(att, par, id);
    }
 });

OR you could just use SWFObject's embedSWF function, which has domload detection built-in:

var flashvars = { foo: "bar" };
var par = {};
var att = {};
swfobject.embedSWF("flash/video.swf", "video-container", "385", "312", "6.0.0", false, flashvars, par, att);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文