Scheduling is deprecated. Calls to the POST /ID/live-video
endpoint with the planned_start_time
parameter will return an error. To schedule a live video, use the event_params
parameter.
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.
To create a live video broadcast with a future start date on a User, Page, Group, or Event, send a request to:
POST /{node-id}/live_videos?status=SCHEDULED_UNPUBLISHED&planned_start_time={start-time}
Use the planned_start_time
parameter and a UNIX timestamp to indicate the desired start time.
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.
curl -i -X POST \
"https://graph.facebook.com/{page-id}/live_videos?status=SCHEDULED_UNPUBLISHED&planned_start_time=1541539800&access_token={access-token}"
{ "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.
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
of the LiveVideo
object.
curl -i -X GET \
"https://graph.facebook.com/{live-video-id}
?fields=dash_preview_url
&access_token={access-token}"
{ '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.
To get a list of scheduled broadcasts for a User, Page, Group, or Event, get an appropriate access token with the publish_video
permission and send a request to:
GET /{node-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.
curl -i -X GET \
"https://graph.facebook.com/{page-id}/live_videos?broadcast_status=["SCHEDULED_UNPUBLISHED"]&access_token={access-token}"
{ "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 } ] }
You can change a scheduled broadcast's start time by sending a request to:
POST /{live-video-id}?planned_start_time={new-start-time}
The {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.
curl -i -X POST \
"https://graph.facebook.com/{live-video-id}?planned_start_time=1541540800&access_token={access-token}"
{ "id": "10214937378883406" }
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.
curl -i -X POST \
"https://graph.facebook.com/{live-video-id}?status=LIVE_NOW&access_token={access-token}"
{ "id": "10214937378883406" }