Facebook媒体附件 - 'music'类型的后备URL?



我正在使用Facebook的Legacy REST API将MP3媒体附件发布到用户的流中(因为新的Graph API还不支持音频)。这将按预期在Facebook自己的媒体播放器中渲染音频。然而,由于播放器是Flash组件,它不会在iOS设备上渲染,并提示进行Flash升级。我想提供一个后备URL,这样用户就可以用HTML5音频播放器点击外部网站。

有办法做到这一点吗?在attachment对象中提供href参数:

access_token = 1234567890.....,
format = 'json',
privacy = {
    value: 'EVERYONE'
},
message = 'Message goes here...',
attachment = {
    href: 'http://www.google.com',
    media:[{
        type:'mp3',
        src:'http://www.looptvandfilm.com/blog/Radiohead - In Rainbows/01 - Radiohead - 15 Step.MP3',
        title:'15 Step',
        artist:'Radiohead',
        album:'In Rainbows'
    }]
}

或者在post对象本身中:

access_token = 1234567890.....,
format = 'json',
privacy = {
    value: 'EVERYONE'
},
message = 'Message goes here...',
href: 'http://www.google.com',
attachment = {
    media:[{
        type:'mp3',
        src:'http://www.looptvandfilm.com/blog/Radiohead - In Rainbows/01 - Radiohead - 15 Step.MP3',
        title:'15 Step',
        artist:'Radiohead',
        album:'In Rainbows'
    }]
}

似乎没有任何效果。。。

因此,我是否被限制使用flash媒体类型,提供我自己的SWF播放器和图像?

您可以在post对象上尝试action_links数组属性,为用户添加自定义链接。

action_links = [("text":"alternate site link text here","href":"alternate url here"}]

您可以尝试YepNope之类的东西来测试iOS,并根据测试加载不同的脚本。

yepnope({
   test: '<test for iOS here>',
   yep: '/scripts/scriptDefiningUrl.js',
   nope: '/scripts/scriptDefiningFallbackUrl.js',
   callback: function (url, result, key) {
      alert('scripts loaded!');
   }
});

最新更新