skip to Main Content

I am using Facebook Live inside of a web app to live stream videos. I am wondering if it is possible to include the live commenting associated with the video on my site in real time. I know I can grab the comments from the graph API, however this is not real time. The comment embed widget is also not real time and would need to be constantly refreshed.

The documentation says :

“You can read live video comments by polling the Live Video
Comments
edge
.”

What is polling? How do I do this and is it possible from a front end web app.

Basically my question is how do I include the live comments along with Facebook Live video on my own website.

2

Answers


  1. I know I can grab the comments from the graph API, however this is not real time.

    This is as real time as it can get. If someone posts a comment and you immediately query the Graph API, you will see their comment.

    What is polling?

    As there is currently no streaming data endpoint for comments, you must query the comments on the live video repeatedly. That is, every 2 seconds or so, refresh the data.

    This is done by making a Graph API GET request for /{video-id}/comments. I also suggest setting "order": "reverse_chronological" in the parameters so that you get the newest comments first.

    You can see some sample code for doing this as part of the Live Comments Teleprompter: https://github.com/fbsamples/live-comments-teleprompter/blob/master/js/main.js#L89-L103

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search