Working with Facebook Live

Posted by on Dec 19, 2016 in Code Chat | No Comments
Working with Facebook Live

I’ve spent some time recently working with the Facebook Live API and since this is a fairly new service which is being heavily promoted I thought it might be useful to share my experiences with it.

The aim was to build a tool that would pop up a message on the website when a channel goes live, and allow users to stream the live video on the site to keep them engaged without diverting traffic away.

Graph API Query

The Facebook Graph API is really powerful and rich in the depth of data that can be queried. Live videos are included in the regular videos query with a new attribute called “live_status” returned for each video. These statuses aren’t well documented, but the possible values are:

“LIVE” when a stream is currently live

“VOD” when a video was live, and is still available to view

I get the feeling that the graph API changes so rapidly that the documentation sometimes struggles to keep up. Several of the methods I had to figure out manually suing their Graph API explorer.

Embedding Video

This is where things get confusing… The query returns an attribute called “embed_html” but Facebook advise against using this and instead using their client JS library to embed the video via the ID. Unfortunately I found this to be unreliable – in one case even though the video was marked as “embeddable=true” the video showed an error when I tried to embed it saying “This video could not be embedded”. For this reason, I reverted to using the embed_html property.

Mobile Video

Unfortunately I discovered a limitation that live video cannot currently be embedded in iOS. Videos that were live can be streamed, and pre-recorded videos will stream. But not those that are live now. This is a shame, and is presumably something that Facebook will be working to fix soon but it’s an indication of how new this technology is.

There is also the issue on iOS that affects all embedded video that you cannot auto-play video, so users must click on the video thumbnail before it will begin to play.


When the channel goes live on Facebook this message pops up in the corner of the screen. Users can dismiss the message, which will be remembered for 2 hours or they can choose to expand the message in to a video player.


The live video streams on the site in a dialog which can be dragged to a different position on the screen and its placement will be remembered across page loads.

Leave a Reply