Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Facebook Live API with Elemental Live

What is Facebook Live API

Facebook Live API enables media organizations to seamlessly incorporate Live into their
existing broadcast setup and also create new ways to interact with their viewers.

The Live API also makes it possible for device manufacturers to integrate Live directly into
video products.

Facebook Quick Start Guide Documentation

Follow the link below to get familiar with the quick start guide.
https://developers.facebook.com/docs/videos/live-video/getting-started

The diagram is event workflow for a broadcast event posting to Facebook Live.
How to use it the script

The script implements a minimum workflow of the new Facebook Live API. It does not handle
advanced features to allow user to choose Facebook Pages etc. It posts video to your Facebook
account’s home page.

The demo has a pre-defined video source file that assumes with the following value, you need
to have your Elemental Live encoder to have this file at the correct location, or you need to
change the channel.php file to change the following line to your video input file or other video
source.

<uri>/data/home/elemental/Sintel.2010.1080p.mkv</uri>

The script takes the following parameters:

fblive [live|broadcast] <encoder>


live: publish live videos to Facebook home page.
broadcast: create live broadcast from Facebook.
<encoder>: encoder hostname or IP address.

Option live:
This is the traditional method of posting live video to your Facebook account. The
difference compared to prior workflow is that you only need to authorize your encoder (device)
at https://facebook.com/device. Once the registration process completes, the script will
automatically take care of video stream setup, including video post URL and key values.

Option broadcast:
This is a broadcast workflow that helps people use Facebook Live to have a similar
experience of video production workflow.

Once the encoder is authorized into your Facebook account, the user controls Facebook
Live video in Facebook web site.

<encoder> is the Elemental Live encoder’s hostname or IP address, the host machine runs the
script needs to be able to communicate with <encoder>.

Step by Step Process to Use the Script with your Elemental Live Encoder

1. Prepare the script, copy to your local machine, make adjustment on the target encoders
video file in channel.php file, and start the script as below:

$ php ./fblive.php broadcast <encoder_ip>


2. The script should have the following messages printed out, log into your Facebook account,
and go to https://www.facebook.com/device, type in the user code below to authenticate
the encoder.

Code : 13f96bebbb362b0803c5e0ad372f89fb
User Code : L9CFBLF8
Expires In : 420 seconds
Inteval : 5 seconds
verification_uri : https://www.facebook.com/device

3. Once authenticated, go back to your Home Page, and Click the Live Video Icon to start.

4. Select Connect on the top, and on the right side of the Live Encoder drop down box, select
the associated Encoder. You will see the following GUI in your Facebook GUI.

The URL and Stream Key are auto generated by Facebook, which will be communicated to
the script via Live API, and used to configure Live Encoder.
5. Once the Encoder has been selected, you can watch the output from the script, and monitor
Elemental Live encoder, the encoder should have been configured to start a live event, and
the following Preview page should show automatically.

6. Click “Go Live” button to publish this event to your Facebook page.
7. Check Elemental live encoder, it should have a live event started and posting live videos to
Facebook.
8. Go to your Facebook home page to check live video.

9. After “Go Live” from Facebook GUI, it becomes a monitor GUI, and a “Finish” button
appears at the bottom right corner.
10. Click “Finish” button to end your Live video. Check Live Encoder to see the Live Event will
be terminated as well.

11. The script will output status information depends on the stage of the live broadcast
workflow. Comparing the console output with the workflow diagram will help understand
the API.
Identified product Gaps/Feature Requests
1. RTMPS protocol support

Facebook plans to cut off none secure RTMP video ingest by end of 2017, it is imperative
for Elemental Live to support RTMPS contribution to Facebook.

2. Frame accurate broadcast

Facebook defines a way to allow frame accurate broadcast for Facebook Live video, it is
using RTMP AMF0 data onGolive message to carry a timestamp information when the
video is public visible to the public. See below for details.

You might also like