facebookarchive / php-graph-sdk

The Facebook SDK for PHP provides a native interface to the Graph API and Facebook Login. https://developers.facebook.com/docs/php
Other
3.17k stars 1.95k forks source link

Problem embedded live video #1103

Open heyselecta opened 5 years ago

heyselecta commented 5 years ago

Hello,

I can generate a rtmp link with this standard code, the live is OK but the live videos can't be embedded :

<?php
require_once 'Facebook/autoload.php';
$fb = new Facebook\Facebook([
  'app_id' => '****',
  'app_secret' => '****',
  'default_graph_version' => 'v3.2',
  ]);

  $access_token = 'EAAFXJCK****';

try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/589672088145615/live_videos',
    array (
      'status' => 'LIVE_NOW',
      'title' => 'Test',
      'description' => 'Live live liiiive',
    ),
    $access_token
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
 ?>

When i do a GET I have this infos :

[items:protected] => Array
        (
            [0] => Facebook\GraphNodes\GraphNode Object
                (
                    [items:protected] => Array
                        (
                            [title] => Test
                            [status] => VOD
                            [stream_url] => rtmp://live-api-s.facebook.com:80/rtmp/589690774810413?s_sw=*****
                            [secure_stream_url] => rtmps://live-api-s.facebook.com:443/rtmp/589690774810413?s_sw=*****
                            [embed_html] => <iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2F589672088145615%2Fvideos%2F338009943468660%2F&width=1280" width="1280" height="720" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe>
                            [id] => 589690774810413
                        )

                )

        )

I have the embed_html, but every time, I have this message :

Video Unavailable This video may no longer exist, or you don't have permission to view it. Learn More

If I go manually on my page (to do a new post), then I click on "live" and I paste the rtmp addresse & key in my encoder, it works, I can embed the live video (during and after the live).

I tried to do a POST like this

try {
    // Returns a `FacebookFacebookResponse` object 
    $response = $fb->post( 
    '/589690774810413', 
    array ( 'embeddable' => 'true' ), $access_token
); } 
catch(FacebookExceptionsFacebookResponseException $e) { 
echo 'Graph returned an error: ' . $e->getMessage(); 
exit; } catch(FacebookExceptionsFacebookSDKException $e) { 
echo 'Facebook SDK returned an error: ' . $e->getMessage(); exit; } 
$graphNode = $response->getGraphNode();
print_r($graphNode);

The response is 'Success' but is not embeddable :-(

Do you have an idea to help me plase ? Thank you

heyselecta commented 5 years ago

no idea ??

kamel-romdhani commented 5 years ago

see this https://developers.facebook.com/docs/live-video-api/faq/ Is it possible to embed a live video? How?

ooker777 commented 3 years ago

see this https://developers.facebook.com/docs/live-video-api/faq/ Is it possible to embed a live video? How?

The link is dead, can you give a new link?

The only link I have is I can't view or play videos on Facebook. | Facebook Help Centre, which is useless.