Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to obtain the live video id of a facebook live video?

I am trying to access the live views count of a live video that is live through a Facebook Page. I am using the ID that I am obtaining from the API request {page-id}/videos/uploaded When I am using that video id and making a GET request of {video-id}?fields='live_views its showing error code of 100 with the message as:

(#100) Tried accessing nonexisting field (live_views) on node type (Video)

I have the following permissions:

'manage_pages', 'publish_pages', 'business_management', 'read_insights', 'user_videos'

I am making the GET request using user_access_token. I am using Graph API Version 2.8.

Please let me know if I am using the wrong ID. IF yes, then how can i get the live_video_id of a live video posted in page?

like image 822
Shatabdi Mohapatra Avatar asked Jan 12 '17 07:01

Shatabdi Mohapatra


People also ask

How do I get the Facebook live stream URL?

In the Select a video source section, click on Streaming Software. Facebook will display a Stream Key. Expand the Advanced Settings section to reveal the Server URL. The Stream Key and Server URL will be used in the Live module.

What is Facebook live API?

The Live Video API enables video encoders, cameras, web, and desktop applications to stream live video directly to Facebook user profiles, pages, and groups. As long as your app can produce a live RTMPS stream, you can stream to Facebook using the Live Video API.


1 Answers

To get the live views count of a video a fan page, you need:

  • An app created at facebook developer
  • A user access token (for testing, e.g. by calling https://developers.facebook.com/tools/accesstoken/)
  • The fan page id

With this you can call graph API in the following format: https://graph.facebook.com/v2.8/<fan_page_id>/live_videos?access_token=<access_token>?fields=live_views

Of course, you may add more elements in fields parameter if you need more information. Here Facebook's Graph API explorer helps: https://developers.facebook.com/tools/explorer

When you add status to fields parameter, "LIVE" means, it's currently live, "VOD" means it has already finished.

If you try to implement a WebHook for it, let me now if it works. Thanks.

like image 181
Raul Pinto Avatar answered Sep 19 '22 14:09

Raul Pinto