This document explains how to use the Live Video API to broadcast a live video broadcast with your app. If you do not have an app, you can use the Graph API Explorer and streaming software of your choice.
Em 10 de junho de 2024, a Meta lançará novos requisitos que precisarão ser atendidos antes que uma conta possa iniciar uma live no Facebook. Estes são os novos requisitos:
If you have an app, you will need the following:
publish_video
If you don't have an app, you also will need:
To create a LiveVideo object, send a POST
request to the /me/live_videos?status=LIVE_NOW
endpoint where me
is the ID for the User or Page.
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.
curl -i -X POST \
"https://graph.facebook.com/v21.0
/me/live_videos?status=LIVE_NOW"
This will return a response that looks like this:
{ "id": "10214937378883406", //The LiveVideo object ID "stream_url": "rtmp://rtmp-api.faceboo...", "secure_stream_url": "rtmps://rtmp-api.faceboo...", //The stream URL "stream_secondary_urls": [], "secure_stream_secondary_urls": [] }
Capture the id
and secure_stream_url
values that were returned to you. The id
is the LiveVideo object ID which you can use to manipulate your broadcast. The secure_stream_url
is the ingest URL that you will use to stream live video data from your encoder to the LiveVideo object.
Pass the secure_stream_url
value that you captured in the last step to your encoding device and stream live video data to it. Once the LiveVideo object detects streaming data, the broadcast will go live on your User profile.
View your profile and verify that a new live video post has been created and is broadcasting your streaming data.
If you are using streaming software instead of developing your own app, manually add the secure_stream_url
value to your software. Depending on which streaming software you are using, you may have to break the stream URL into its server (rtmps://rtmp-api.facebook.com/rtmp/
) and key components (everything after /rtmp/
).
To end the broadcast, send a POST
request to the /<LIVE_VIDEO_ID>?end_live_video=true
endpoint.
curl -i -X POST \
"https://graph.facebook.com/v21.0
/<LIVE_VIDEO_ID>?end_live_video=true"
This ends your broadcast and saves it as a video on demand (VOD). If you want to delete the VOD, send a request to the DELETE /<LIVE_VIDEO_ID>
endpoint.
Code | Subcode | Message | Type | Mitigation messaging |
---|---|---|---|---|
200 | 1363120 | Permissions error | OAuthException | You’re not eligible to go live Your profile needs to be at least 60 days old before you can go live on Facebook. Learn more at https://www.facebook.com/business/help/167417030499767?id=1123223941353904 |
200 | 1363144 | Permissions error | OAuthException | You’re not eligible to go live You need at least 100 followers before you can go live from your profile. Learn more at https://www.facebook.com/business/help/167417030499767?id=1123223941353904 |