Search code examples
hrefattachmentfacebook-rest-api

Facebook Media Attachment - fallback URL for 'music' type?


I'm using Facebook's Legacy REST API to publish MP3 media attachments to users' streams (as the new Graph API does not yet support audio). This renders the audio in Facebook's own media player as expected. However, because the player is a Flash component, it doesn't render on iOS devices and prompts for a Flash upgrade. I'd like to provide a fallback URL instead so the user can click through to an external site with an HTML5 audio player instead.

Is there a way of doing this? Supplying the href parameter in either the attachment object:

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'
    }]
}

or in the post object itself:

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'
    }]
}

does not seem to have any effect...

Am I therefore restricted to using the flash media type, supplying my own SWF player and image?


Solution

  • You can try the action_links array property on the post object to add a custom link for the user.

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