Search code examples
facebookfacebook-graph-apiaudiomp3audio-streaming

Facebook API Cant upload streaming audio to page wall


I have a music blog and would like to duplicate all my posts to facebook, but I can't get the api to post streaming audio like I can when I post manually. It does actually post, but the audio is stripped out. Here is my code:

<?php

require 'facebook-php-sdk/src/facebook.php';
$APP_ID = 'MYAPPID';
$APP_SECRET = 'MYAPPSECRET';
$PAGE_ID = 'MYPAGEID';
$ACCESS_TOKEN = 'GENERATEDACCESSTOKEN';

$facebook = new Facebook(array(
  'appId'  => $APP_ID,
  'secret' => $APP_SECRET,
  'cookie' => true,
));

$attachment = array(
                'message' => 'some message',
                'attachment' => '{"media": [{"type": "mp3","src": "http://EXAMPLE.COM/music.mp3", "title": "title", "artist": "artist", "album":"album"}]}',
                'access_token' => $ACCESS_TOKEN
              );

$result = $facebook->api('/'.$PAGE_ID.'/feed', 'post', $attachment);

if($result){ 
    echo "<p>Posted status update</p>";
}
else { 
    echo "<p>Unable to post update.</p>";
}

?>

Any Idea how I can fix this? Thanks y'all


Solution

  • That's not possible, only whitelisted partners are able to use Open Graph Music tags.
    More info here - https://developers.facebook.com/docs/opengraph/music/