3

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?

Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
chrisfrancis27
  • 4,516
  • 1
  • 24
  • 32

2 Answers2

1

You could try something like YepNope to test for iOS and load a different script based on the test.

yepnope({
   test: '<test for iOS here>',
   yep: '/scripts/scriptDefiningUrl.js',
   nope: '/scripts/scriptDefiningFallbackUrl.js',
   callback: function (url, result, key) {
      alert('scripts loaded!');
   }
});
brheal
  • 1,237
  • 8
  • 14
  • Thanks for the suggestion - however this all runs within Facebook so there is no way of adding Javascript! I'm literally stuck with only what the Facebook API provides. – chrisfrancis27 Jun 29 '11 at 08:48
  • 1
    Sorry about that. I think I see a way to do it through the API. I'll post another answer. – brheal Jun 29 '11 at 15:00
1

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"}]
brheal
  • 1,237
  • 8
  • 14