2011-10-03 117 views
1

我需要能够在Facebook上将音频文件共享到我的墙上和朋友的墙上。另外,当我点击用户个人资料上的共享项目图像时,我也必须播放音频。我怎样才能在Facebook个人资料中共享和播放音频MP3文件/

我已经尝试使用下面的函数来分享,但我不知道我怎样才能改变形象..

function fb_share() { 
    var linkVideo = "http://www.youtube.com/watch?v=nXefLc5VXsGY"; 
    u=linkVideo; 
    t=document.title; 
    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436'); 
} 

我也曾尝试API代码

FB.init({ 
      appId : 'appid', // application Id 
     status : true, // check login status 
     cookie : true, // enable cookies to allow the server to access the session 
      xfbml : true // parse XFBML 
     }); 
    function publishStream(targetId, name, link, picture, source, userName,message) { 
FB.ui(
     { 
      method: 'feed', 

       name: name, 
       link: link, 
       picture: picture, 
       source: source, // The URL of a media file (e.g., a SWF or video file) attached to this post 
        caption: 'Shared by '+userName, 
       actions: {name: 'Try App', link: link}, 
        message: message 

      }, 
      function(response){ 
      if (response && response.post_id) { 

      } else { 

      } 
     }); 
     } 

,但我不能选择我的朋友并张贴到他们的墙上。总之,使用这个API,我需要得到像第一个共享者那样的对话框。

如何在用户配置文件中播放我的音频文件?

+1

嗯,你与闪光和恼人的音乐和独角兽思维的MySpace。 Facebook不会让你在你的页面或其他人的页面上注入随机垃圾。这是Facebook击败MySpace的主要原因 - 它看起来不像一个8岁女孩的大脑在互联网上呕吐。 – evan

回答

0

你不能通过发布在别人的个人资料上播放内容。所有这些代码使得它看起来像是在创建一个应用程序 - 您的朋友需要首先安装/提供访问权限。

更简单的是在YouTube上找到一个视频(看起来你在做什么)。您可以将其发布到墙上,并自动从用户的墙上播放(而不是自动播放)。

此功能已经内置于Facebook。没有必要使用任何代码。

2

使用共享者URL方法,Facebook在您正在共享的页面顶部查找一系列Open Graph元标记。这些标签定义了内容以及Facebook在墙上分享时的内容。

例如,如果你要共享使用JW媒体播放器在您的网站的视频,你会包括你的页面上的下列元标记类型:

<meta property="og:title" content="Bits on the Run introduction video"/> 
<meta property="og:description" content="Bits on the Run is a clear and flexible platform 
for transcoding, managing and streaming your video online."/> 
<meta property="og:image" content="http://example.com/thumbs/yYul4DRz-320.jpg" /> 
<meta property="og:site_name" content="http://www.mysite.com" /> 
<meta property="og:type" content="movie"/> 
<meta property="og:url" content="http://example.com/previews/MSO47ORl-tBhZ0fIU"/> 
<meta property="og:video" content="http://example.com/players/yYul4DRz-tBYU3ED4.swf" /> 
<meta property="og:video:height" content="245" /> 
<meta property="og:video:width" content="400" /> 
<meta property="og:video:type" content="application/x-shockwave-flash" /> 

使用例如JW媒体播放器,以及包括您可以通过包含og:image参数来与音频内容共享音频元标签。您正试图直接共享Youtube视频,因为您无法直接访问网页,因此您无法修改YouTube上元标记的内容。请使用将Yotube作为参数并使用音频文件/ mp3的JW player

以获取更多信息看这里:

https://developers.facebook.com/docs/opengraph/

+0

嗨,如何分享一个音频文件在Facebook使用addthis?请指教我。 – user2003356

相关问题