# Getting Started



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.

## Before You Start

If you have an app, you will need the following:

- [A Meta App ID with the Facebook Login Use Case](https://developers.facebook.com/documentation/development/create-an-app/facebook-login-use-case)

- [Facebook Login implemented in your app](https://developers.facebook.com/documentation/facebook-login)

- If your app is on a device that does not have an interface that allows users to sign into Facebook, implement
[Facebook Login for Devices](https://developers.facebook.com/documentation/facebook-login/for-devices)
instead.

- The following permissions:
[`publish_video `](https://developers.facebook.com/docs/permissions/reference/publish_video)

- An
[access token](https://developers.facebook.com/documentation/facebook-login/guides/access-tokens)

If you don't have an app, you also will need:

- The
[Graph API Explorer](https://developers.facebook.com/docs/graph-api/explorer)

- Video streaming software

## Start the broadcast

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.](https://developers.facebook.com/documentation/facebook-login/guides/access-tokens#portabletokens)

```curl
curl -i -X POST \
 "https://graph.facebook.com/v25.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.

## Stream the broadcast

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/`).

## End the broadcast

To end the broadcast, send a `POST` request to the `/<LIVE_VIDEO_ID>?end_live_video=true` endpoint.

### Example end broadcast request

```curl
curl -i -X POST \
  "https://graph.facebook.com/v25.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.

## Next Steps

* Use the Live Video API to [schedule a live video](https://developers.facebook.com/documentation/live-video-api/guides/scheduling) for a future broadcast.