开发者

How can I share an audio mp3 file on facebook?

I want to share an audio mp3 file using faceboo api. I need to share it with my friends and on my wall. Once on the facebook profile, I need to be able to play the audio file when i click on it.

开发者_开发知识库
$link = "link to some mp3 file";
function streamPublish(name){
        FB.ui({
          method: 'stream.share',
          attachment: {
            name:'Louis Dousset viens de t\'envoyer un message grâce à la Sweet Machine',
            caption:'Caption',
            description:"Desc",

            "media": [{
            "type": "mp3", 
            "src": $link, 
            "title": "", 
            "artist": "", 
            "album": "",
            "href": ""
        }]

          },
          display: 'page'
        });
    }

I am using the above function. I am getting not able to get the mp3 url; How can I sort this out?


Make sure you have the proper Open Graph Protocol meta tags for an audio/mp3 file on your website. Use this tool to what Facebook sees when it parses your page: https://developers.facebook.com/tools/debug/

Here is a page that has the proper meta tags: http://www2.highpoint.edu/president.php?mp3=http%3A%2F%2Fwww2.highpoint.edu%2Fmp3%2Fsot050806b.mp3

Here is the debugger output for that page: http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww2.highpoint.edu%2Fpresident.php%3Fmp3%3Dhttp%253A%252F%252Fwww2.highpoint.edu%252Fmp3%252Fsot050806b.mp3

The audio player on the Facebook News Feed/Timeline is broken. But it should be fixed, I assume. So you should be OK to develop this and wait for Facebook to fix their broken mp3 player.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜