Scheduled Live Videos

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

Scheduling Live Videos

To create a live video with a future start date, send a POST request to the /live_videos edge on a User, Page, or Group node, and include the status=SCHEDULED_UNPUBLISHED parameter. Use the planned_start_time parameter and a UNIX timestamp to indicate the desired start time.

This will create a Live Video object on the targeted node and return the live video's stream_url, secure_stream_url, and id. Use the stream URLs to send data to the live video at, or before, it's scheduled start time. The live video will appear on the node's timeline/feed at the planned start time as long as it is receiving stream data.

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

Sample Request

curl -i -X POST \ 
  "https://graph.facebook.com/{your-page-id}/live_videos
    ?status=SCHEDULED_UNPUBLISHED
    &planned_start_time=1541539800
    &access_token={access-token}"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/{your-page-id}/live_videos",
  new JSONObject("{\"status\":\"SCHEDULED_UNPUBLISHED\",\"planned_start_time\":\"1541539800\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{your-page-id}/live_videos"
           parameters:@{ @"status": @"SCHEDULED_UNPUBLISHED",@"planned_start_time": @"1541539800",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{your-page-id}/live_videos',
  'POST',
  {"status":"SCHEDULED_UNPUBLISHED","planned_start_time":"1541539800"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/{your-page-id}/live_videos',
    array (
      'status' => 'SCHEDULED_UNPUBLISHED',
      'planned_start_time' => '1541539800'
    ),
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

Sample Response

{
  "id": "{your-live-video-id}",
  "stream_url": "rtmp://rtmp-api.facebook...",
  "secure_stream_url": "rtmps://rtmp-api.facebook..."
}

To get a list of scheduled live videos, scroll down to the Getting Schedule Live Videos section below.

Previewing a Stream

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

Getting Scheduled Live Videos

To get a list of scheduled live video posts for a User, Page, or Group, get an appropriate access token with the publish_video permission, then send a GET request to the target node's /live_videos edge and use the broadcast_status parameter to request videos with a status of ["SCHEDULED_UNPUBLISHED"]. Note that the status string must be in an array.

Refer to the Live Video node reference for a complete list of live video status values.

Sample Live Video List for a Page

curl -i -X GET \ 
  "https://graph.facebook.com/{your-page-id}/live_videos
    ?broadcast_status=["SCHEDULED_UNPUBLISHED"]
    &access_token={access-token}"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/{your-page-id}/live_videos",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

Bundle parameters = new Bundle();
parameters.putString("broadcast_status", "["SCHEDULED_UNPUBLISHED"]");
request.setParameters(parameters);
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{your-page-id}/live_videos"
           parameters:@{ @"broadcast_status": @"["SCHEDULED_UNPUBLISHED"]",}
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{your-page-id}/live_videos',
  'GET',
  {"broadcast_status":"[\"SCHEDULED_UNPUBLISHED\"]"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->get(
    '/{your-page-id}/live_videos',
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

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": "{your-live-video-id}" 
    }
  ]
}

Rescheduling a Scheduled Live Video

Change a scheduled live video's start time by sending a POST request to the live video's ID and including the new, UNIX time stamp in the planned_start_time parameter.

Upun success, the API will respond with the scheduled LiveVideo object's ID.

Sample Live Video for a Page

curl -i -X POST \
  "https://graph.facebook.com/{your-live-video-id}
    ?planned_start_time=1541540800
    &access_token={access-token}"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/{your-live-video-id}",   
  new JSONObject("{\"planned_start_time\":\"1541540800\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{your-live-video-id}"    
           parameters:@{ @"planned_start_time": @"1541540800",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{your-live-video-id}', 
  'POST',
  {"planned_start_time":"1541540800"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/{your-live-video-id}', 
    array (
      'planned_start_time' => '1541540800'
    ),
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

Example Response

{
  "id": "{your-live-video-id}"
}

Starting A Scheduled Live Video Immediately

You can immediately start a scheduled live video by sending a POST request to the live video node and including the status=LIVE_NOW parameter.

Upon success, the API will respond with the LiveVideo object's ID.

Sample Request

curl -i -X POST \
 "https://graph.facebook.com/{your-live-video-id}
   ?status=LIVE_NOW
   &access_token={your-page-access-token}"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/{your-live-video-id}",
  new JSONObject("{\"status\":\"LIVE_NOW\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{your-live-video-id}"
           parameters:@{ @"status": @"LIVE_NOW",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{your-live-video-id}',
  'POST',
  {"status":"LIVE_NOW"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/{your-live-video-id}',
    array (
      'status' => 'LIVE_NOW'
    ),
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

Example JSON Response

{
  "id": "{your-live-video-id}"
}