I’m using php to use the facebook live api, I can start the live and I can see the stream but other users can’t.
What am I missing?
EDIT:
Here’s the code that I’m using.
<?php
#print_r($_GET);
$token = $_GET['token'];
$nome = $_GET['nome'];
$id = $_GET['id'];
$stream = $_GET['stream'];
system("echo $id > /tmp/id_fb");
system("echo $token > /tmp/token_fb");
$id = file_get_contents("/tmp/id_fb");
$token = file_get_contents("/tmp/token_fb");
$id = trim($id);
$token=trim($token);
echo "Token:".$token."<br/>";
echo "Id: ".$id."<br/>";
include ("fb.php");
//echo $token;
$linkData = [
'description' => 'teste',
'title' => "$stream",
];
try {
$response = $fb->post("/$id/live_videos", $linkData, $token);
}catch(FacebookExceptionsFacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
}catch(FacebookExceptionsFacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$video = $response->getDecodedBody();
print_r($video);
print_r($video);
$vid = $video['id'];
$rtmp_url = $video['stream_url'];
echo "A url rtmp:";
echo "$rtmp_url";
?>
Thanks.
2
Answers
After trying alot of stuff, i just found out that my app on facebook wasn't public. That was the issue, hope this helps anyone.
It seems that you didn’t specify the privacy of your live-video so that it is visible to all.