Schedule a Broadcast

You can use the Live Video API to create live video broadcasts that will go live at a predetermined time, up to seven days from their creation date.

On June 10th, 2024, Meta is launching new requirements that must meet before an account can go live on Facebook. The new requirements are as follows:

  • The Facebook account must be at least 60 days old
  • The Facebook Page or professional mode profile must have at least 100 followers

Visit our Help Center to learn more about this change.

To create a live video broadcast with a future start date on a User, Page, Group, or Event, send a request to:

POST /<ID>/live_videos?status=SCHEDULED_UNPUBLISHED&event_params=<UNIX_TIMESTAMP_FOR_START_TIME>

Use the event_params parameter and a UNIX timestamp to indicate the desired start time.

When testing an API call, you can include the access_token parameter set to your access token. However, when making secure calls from your app, use the access token class.

This will create a LiveVideo object on the targeted node and return the live video's secure_stream_url and id. Use the secure stream URL with your encoder to stream live video data to the LiveVideo object at, or before, it's scheduled start time. The broadcast will appear on the node's timeline/feed at the planned start time as long as it is receiving stream data.

Scheduled broadcasts can receive streaming data at any point before their start date, for preview purposes.

Sample Request

curl -i -X POST \ 
      "https://graph.facebook.com/v21.0/<ID>/live_videos?status=SCHEDULED_UNPUBLISHED&event_params=1541539800"

Sample Response

{
  "id": "10214937378883406",  //LiveVideo object ID
  "stream_url": "rtmp://rtmp-api.facebook...",
  "secure_stream_url": "rtmps://rtmp-api.facebook..."  //Stream URL
}
    

To get a list of scheduled broadcasts, see Getting Scheduled Broadcasts.

Previewing a Broadcast

You can use the Live Video API to preview an unpublished live video broadcast; a LiveVideo object created with status set to SCHEDULED_UNPUBLISHED or UNPUBLISHED.

To preview an unpublished live video broadcast, send a request to:

GET /<LIVE_VIDEO_ID?fields={fields}

Use the fields parameter to get the dash_preview_url for the LiveVideo object.

Sample Request

curl -i -X GET \
 "https://graph.facebook.com/v21.0/<LIVE_VIDEO_ID>?fields=dash_preview_url"

Sample Response

{
  'dash_preview_url': 'https://video.xx.fbcdn.net/...',
  'id': '<LIVE_VIDEO_ID>'
}

This returns the live video's dash_preview_url and id. Copy and paste the URL into a Dash Player to preview the broadcast.

Although previewing your broadcast with a third-party test player is a good way to verify the content of your broadcast, we recommend that you broadcast on a test page. You must be a page admin or editor in order to broadcast the page. Additionally you can set the privacy parameter to create streams visible to only you.

Get Scheduled Broadcasts

To get a list of scheduled broadcasts for a User, Page, or Event, get an appropriate access token with the publish_video permission and send a request to:

GET /<ID>/live_videos?broadcast_status=["SCHEDULED_UNPUBLISHED"]

Note that the broadcast_status value must be an array. Refer to the LiveVideo reference for a complete list of additional values.

Sample Broadcast List for a Page

curl -i -X GET \ 
  "https://graph.facebook.com/v21.0/<ID>/live_videos?broadcast_status=["SCHEDULED_UNPUBLISHED"]"

Sample Response

{
  "data": [
    {
      "status": "SCHEDULED_UNPUBLISHED",
      "stream_url": "rtmp://rtmp-api-dev.facebook.com:80/rtmp/...",
      "secure_stream_url": "rtmps://rtmp-api-dev.facebook.com:443/rtmp/...",
      "embed_html": "<iframe src=\"https://www.facebook.com/plugins/video.php?...",
      "id": "10214937378883406 "  //LiveVideo object ID
    }
  ]
}

Reschedule a Broadcast

You can change a scheduled broadcast's start time by sending a request to:

POST /<LIVE_VIDEO_ID>?event_params=<UNIX_TIMESTAMP_FOR_NEW_START_TIME>

The <UNIX_TIMESTAMP_FOR_NEW_START_TIME> value must be a UNIX time stamp indicating the new start time. Upon success, the API will respond with the LiveVideo object's ID.

Sample Live Video for a Page

curl -i -X POST \
  "https://graph.facebook.com/v21.0/<LIVE_VIDEO_ID>?event_params=1541540800"

Example Response

{
  "id": "10214937378883406"
}

Starta Broadcast Immediately

You can start a broadcast immediately by sending a request to:

POST /<LIVE_VIDEO_ID>?status=LIVE_NOW

The broadcast will go live if the stream URL associated with the LiveVideo object, which represents the broadcast, is receiving stream data. Upon success, the API will respond with the LiveVideo object's ID.

Sample Request

curl -i -X POST \
  "https://graph.facebook.com/v21.0/<LIVE_VIDEO_ID>?status=LIVE_NOW"

Example JSON Response

{
  "id": "10214937378883406" // <LIVE_VIDEO_ID>
}