Skip to content

Commit c69e77d

Browse files
authored
Merge pull request #267 from apivideo/live-stream-v2-docs
Update live streaming docs with SRT
2 parents 4ef621f + 958906a commit c69e77d

File tree

2 files changed

+53
-16
lines changed

2 files changed

+53
-16
lines changed

live-streaming/create-a-live-stream.md

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ Creating a live stream is simple with api.video. After you create it, you have a
1010

1111
<iframe src="https://embed.api.video/vod/vi6mgcrUqQuLyQNRW0qbl6gt" type="text/html" width="100%" height="500" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>
1212

13-
This guide helps you follow along with the video and learn how to set up your live stream with api.video, and then use OBS to broadcast.
13+
This guide helps you follow along with the video and learn how to set up your live stream with api.video, and then use OBS to broadcast.
14+
15+
{% capture content %}
16+
api.video supports both `RTMP` and `SRT` protocols for live streaming.
17+
18+
Accepting live streams through `SRT` **is currently in beta** - reach out if you have any questions or encounter any issues!
19+
{% endcapture %}
20+
{% include "_partials/callout.html" kind: "info", content: content %}
1421

1522
## API reference
1623

@@ -179,25 +186,38 @@ curl --request POST \
179186
{% endcapture %}
180187
{% include "_partials/code-tabs.md" samples: samples %}
181188

182-
## Connect live video to your live stream container
189+
## Connect to your live stream container
183190

184-
You'll want to grab your live stream's streamKey from the response. It's required for use with OBS. To get started:
191+
In this example, we will use [OBS Studio](https://obsproject.com), which is an open-source broadcasting application, to manually set up a live stream broadcast.
185192

186-
1. Install OBS. You can grab the software here: [OBS Studio](https://obsproject.com/)
193+
### Set up the streaming service
187194

188-
2. Establish a source. In the sources section, choose a video feed to share. You could choose to share your screen or to share your camera (on a Mac: Video Capture Device, and then in the "Device" dropdown, select the camera). You should now see the video source in the main OBS window.
195+
1. Open OBS and go to File and then Settings. In the Settings menu, go to **Stream**.
189196

190-
3. Connect OBS to api.video. Under Settings, choose **Stream**. You'll see a choice for service - select **api.video**.
197+
2. Next, you have to set up the streaming service provider. With api.video, you have the option to choose between `RTMP` and `SRT` protocols for live streaming.
191198

192-
4. The server should be **Default**, and the streamKey is the value you received in the JSON response when you created the stream container.
199+
- For `RTMP`, open the dropdown menu for Service, and select **Show all**. In the resulting list, find api.video. This will set up streaming through api.video's default `RTMP` server: `rtmp://broadcast.api.video/s`. You can find the **Stream key** in the API response you received when you created the live stream container.
200+
201+
- For `SRT`, open the dropdown menu for Service, and select **Custom**. Use this server URL: `srt://broadcast.api.video:6200?streamid={stream_key}` and replace `{stream_key}` with the **Stream key** in the API response that you received when you created the live stream container.
202+
203+
You can configure your `SRT` stream through **SRT options**, which you can define using this syntax: `srt://IP:port?option1=value1&option2=value2`. For OBS Studio, the full list of options are those supported by [FFmpeg](https://ffmpeg.org//ffmpeg-protocols.html#srt).
204+
205+
The most important option is `latency`, which is defined in microseconds. The minimum value is 120 ms (`latency=120000`), lower values will be ignored. Check out [OBS Studio's documentation](https://obsproject.com/wiki/Streaming-With-SRT-Or-RIST-Protocols) on the topic.
206+
207+
Once you've set up the streaming service, apply the changes.
193208

194-
5. Click **OK** to accept the changes.
209+
### Set a streaming source
195210

196-
6. Press **Start Streaming**.
211+
3. Establish a source. In the Sources section for OBS, choose the source that you want to stream. This can be a video capture device, your desktop, or even another application.
197212

198-
7. Share the embed, iFrame, so that others can watch your stream!
213+
4. Press **Start Streaming**!
199214

200-
If you can't find **api.video** in the list of services, you can choose **custom** and **rtmp://broadcast.api.video/s** for the server.
215+
To share your stream, grab the embed URL or the `iframe` that you received in the API response when you created the live stream container.
216+
217+
{% capture content %}
218+
All live stream details like your Stream key, the embed URL, and the `iframe` are also available through the api.video dashboard. Go to the [Live streams](https://dashboard.api.video/livestreams) page, and open the Details of the live stream that you want to share.
219+
{% endcapture %}
220+
{% include "_partials/callout.html" kind: "info", content: content %}
201221

202222
## Live stream directly from your dashboard
203223

@@ -213,8 +233,4 @@ If you don't want to set up your live stream programmatically, api.video enables
213233

214234
4. Once the live stream object is created you can click on the **Live Stream Details** button to view more information about the live stream. You can even start your stream directly from the dashboard.
215235

216-
The live stream object contains all the information you'll need if you choose to broadcast using something else like OBS. You can pause the live stream at any time by clicking pause on the video. If you don't see your live stream start right away, give it a few minutes to get ready.
217-
218-
## Conclusion
219-
220-
There are many ways to set up a live stream. OBS is one of the most popular ways to get started.
236+
The live stream object contains all the information you'll need if you choose to broadcast using something else like OBS. You can pause the live stream at any time by clicking pause on the video. If you don't see your live stream start right away, give it a few minutes to get ready.

live-streaming/live-stream-best-practices.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ meta:
1313
- In order to prevent the live stream from getting stuck (buffering indefinitely), please ensure that you are following the recommended [settings](#recommended-setting-for-ingestion).
1414
- Make sure to verify that the connection speed is adequate and stable before the stream is starting.
1515

16+
## Streaming protocols
17+
18+
api.video supports both `RTMP` and `SRT` protocols for live streaming. Accepting live streams through `SRT` **is currently in beta** - reach out if you have any questions or encounter any issues!
19+
20+
### SRT details
21+
22+
* The minimum accepted value for `latency` is 120 ms, lower values will be ignored.
23+
* The required SRT protocol version should be **1.3 or higher** - check your broadcasting application to make sure it supports the correct version.
24+
25+
### Which protocol to use
26+
27+
Take network connection into consideration - if you or your users stream in stable conditions with a low risk of congestion, `RTMP` will probably achieve a better latency than `SRT`. If you or your users experience lots of buffering, or the network you use is known to be unstable, or network conditions may change like when using a mobile network, then `SRT` may be a good fit.
28+
29+
Rembember that both protocols have their pros and cons - with bad network conditions, viewers might encounter buffering with `RTMP`, or they might encounter audio or visual glitches when using `SRT`.
30+
1631
## DVR - reading history in live streams
1732

1833
When a live stream is ongoing, viewers can replay earlier content with the DVR feature. The available buffer is 1 hour, and is only available in live streams that are actively broadcasting.
@@ -29,6 +44,12 @@ When reaching the end of the playback, the player buffers until the live stream
2944

3045
Reconnection is handled by api.video, however, an edge case might occur (very slim chance), which will result in the inability to reconnect to the stream with good quality. In this case, we recommend creating a manual stream reconnection, where the streamer will create a new streaming key while the consumers will have to refresh their player instance.
3146

47+
## Streaming servers
48+
49+
| Protocol | Description | Server URL |
50+
| -------- | ------------------------------------------ | ------------------------------------------------------ |
51+
| `RTMP` | The default streaming server. | `rtmp://broadcast.api.video/s` |
52+
| `SRT` | The `SRT` server, currently **in beta**. | `srt://broadcast.api.video:6200?streamid={stream_key}` |
3253

3354
## Recommended setting for ingestion
3455

0 commit comments

Comments
 (0)