javascript 如何将基于自定义 SWF 的音频播放器嵌入到 facebook 墙帖中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3997811/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to embed a custom SWF based audio player into facebook wall posts?
提问by Jan Deinhard
We have an SWF based audio player. We want to be able to embed this player into Facebook wall posts in the same way that Youtube videos or BandPage songs are embedded into Facebook feed walls. Right now clicking on the image that we provide redirects to the player instead of loading the player inline.
我们有一个基于 SWF 的音频播放器。我们希望能够将此播放器嵌入 Facebook 墙帖,就像将 Youtube 视频或 BandPage 歌曲嵌入 Facebook 动态墙一样。现在单击我们提供的图像会重定向到播放器,而不是直接加载播放器。
UPDATE: We want to embed our SWF player like BandPage does it. We want to have the little play button on top of our image. We also want to have the small symbol left to the date.
更新:我们想像 BandPage 那样嵌入我们的 SWF 播放器。我们希望在我们的图像顶部有一个小播放按钮。我们还希望保留日期的小符号。


Clicking on the image or play button then loads the SWF inline.
单击图像或播放按钮,然后内联加载 SWF。


How can I achieve this with the Facebook JavaScript API? Is it really just a matter of being white listed? Or do I have to provide more parameters?
如何使用 Facebook JavaScript API 实现这一点?真的只是被列入白名单的问题吗?还是我必须提供更多参数?
This is what I have right now:
这就是我现在所拥有的:
function fb_post()
{
var message = 'Look at my fantastic SWF!';
var picture = 'A LINK TO A 100X100 IMAGE';
var link = 'A LINK TO OUR SWF';
var source = 'A LINK TO OUR SWF';
var name = 'Blah blah';
var caption = 'Yada yada yada';
var description = 'Facebook programming';
var type = 'swf';
FB.api('/me/feed', 'post', { message: message, picture: picture, link: link, name: name, type: type }, function(response) {
if (!response || response.error) {
alert('Error occured: ' + response.error.message);
} else {
alert('Post ID: ' + response);
}
});
}
UPDATE: It's working now! We've got the play button on our image and the SWF is loaded and displayed in the Facebook wall :) We haven't got it working with FB.api though. We are using FB.ui.
更新:它现在正在工作!我们的图像上有播放按钮,SWF 已加载并显示在 Facebook 墙上 :) 不过我们还没有让它与 FB.api 一起使用。我们正在使用 FB.ui。
Use this form for the Video Embed Whitelist Request. We had to wait less than a week to get our URLs whitelisted.
将此表单用于视频嵌入白名单请求。我们不得不等待不到一周的时间才能将我们的 URL 列入白名单。
采纳答案by saibotd
You need your domain being white listed. Here is the form: http://www.facebook.com/help/contact.php?show_form=video_embed_whitelist
您需要将您的域列入白名单。这是表格:http: //www.facebook.com/help/contact.php?show_form=video_embed_whitelist
Update: Have you looked into this? This seems to cover your needs (man, you gotta hate FB for putting up all of these API's and the half-arsed documentation)
更新:你有没有研究过这个?这似乎满足了您的需求(伙计,您必须讨厌 FB 提供所有这些 API 和半开玩笑的文档)
This might be interesting:
这可能很有趣:
<meta property="og:video" content="http://www.example.com/player.swf?video_id=123456789"/>
<meta name="video_height" content="200" />
<meta name="video_width" content="300" />
<meta name="video_type" content="application/x-shockwave-flash" />
It's the example for a video-player, but it should work for an audio-player as well.
这是视频播放器的示例,但它也应该适用于音频播放器。
Also read the OpenGraphdocumentation - there is a lot of information on how to make your site Facebook-friendly.
另请阅读OpenGraph文档 - 有很多关于如何使您的网站对 Facebook 友好的信息。
回答by Archana Thapar
I also tried embedding a wav audio file using swf based audio player in a Facebook Post by using metatags.
我还尝试使用元标签在 Facebook 帖子中使用基于 swf 的音频播放器嵌入 wav 音频文件。
What I did is as follows:
我所做的如下:
- Posted a link onto a user's wall using feed graph api.
When the link is clicked, server side I add metatags to response header.
- I am able to post it successfully on user's wall.
- When the same post is viewed by a friend, friend sees the post correctly. On clicking onto pic that has a player button, it plays the audio. On clicking the link URL also it plays correctly. The issue is that the entire post area is clickable and when any area other than link and image is clicked, it shows the html code that I set in response header.
- 使用提要图 api 将链接发布到用户的墙上。
单击链接时,服务器端我将元标记添加到响应标头。
- 我能够成功地将它发布在用户的墙上。
- 当朋友查看相同的帖子时,朋友会正确地看到该帖子。单击具有播放器按钮的图片时,它会播放音频。单击链接 URL 时,它也能正确播放。问题是整个帖子区域都是可点击的,当点击链接和图像以外的任何区域时,它会显示我在响应标题中设置的 html 代码。

