Video trends · 5 min read

Video Live Streaming in Just 5 Easy Steps

Video live streaming in just 5 easy steps

Sharing live video is an exciting way to connect with your audience. Get a live video stream up and running in just 5 steps.

Doug Sillars

February 11, 2020

Sharing live video is an exciting way to connect with your audience. But, if the idea of setting up video live stream infrastructure seems daunting, I’d like to reassure you that it does not have to be! In this post, I’ll walk you through the steps to get a live video stream up and running in just 5 steps, where only 2 are made to the streaming server!

For simplicity, we’ll stream our video from your laptop camera & mic. The first thing you’ll need is some software to record your live stream and upload it to the streaming server. In this example, we’ll use OBS: it is free, and runs on Linux/Mac/Windows.

Create a streaming server

We’ll be using api.video for our streaming server. By sending just two simple API commands, we will be able to initiate our streaming server.

Once you’ve created an account, you’ll end up at the API dashboard, listing your Sandbox API key (The production key will appear when once you have upgraded your account). We’ll need these in a second.

An image of the production and sandbox API keys in your api.video dashboard

Creating the live stream

To create the live stream, we need to send some commands to api.video (check out the API reference documentation here: live streams). We’ll use curl in the terminal to communicate with the API.

  1. The first thing we need to do is authenticate ourselves with our API key. We do that by sending our API key in a post request. In the example below, the stream is being created in the sandbox, so you should use your sandbox API key.

sql

Tip: Make sure you replace <your_api_key> with the sandbox API key from api.video. Keep the double quotes around the API key.

You’ll get a response from the server with your Access Token. You’ll need this string, so copy all of the text between the quotes:

Response server
  1. Now we create the live stream (yes — it really is just two steps!). To do this, you need to tell api.video the name of your stream (and also provide the access token to prove that you are allowed to create the stream):

sql

This command tells the Live Stream API that you are authorized to make changes (your access token), and then sends a small JSON package naming your stream “Your Stream Name” (feel free to change this if you’d like).

Tip: Make sure that when you paste in your access token, you still have that single quote after it.

The response to this command is a JSON file:

sql

The streamKey is used in the next step. You can also see that you have not started streaming yet (broadcasting=false), and there are a bunch of urls. If you open the “Player” url in a browser, you’ll see that you have a live stream! It is not actually streaming any video yet, but we’re getting there.

Live stream name

This background is the default image — We will show you how to change this at the end of the tutorial.

Sending video to the server

  1. Now we need to get OBS to start collecting video from your laptop camera, and send it to api.video.

You need to add video sources. Press the + under sources to add a source.

OBS source

Select “Video Capture Device” and choose the built in camera from the drop down, and click Ok (example is from a Mac):

OBS device

Now you should see your face on the screen, ready for live streaming.

  1. Now we can connect the OBS stream to the stream server at api.video. On the bottom right of OBS, click “Settings”, and open the “Stream” settings. Under Service, select Custom, and add “rtmp://broadcast.api.video/s” for the server, and copy the stream Key from the JSON response in step 2.
OBS settings

Alternatively, you can use the preset settings in OBS under api.video.

screenshot of custom options in OBS.

Save the settings

  1. Click “Start Streaming” in OBS to start sending video from your camera to the streaming server. Open your browser to the Player URL from Step 2, and in a few short seconds, your live stream will appear!

A live stream in 5 steps! That’s all there is to it! Share the links, place them on your site, and stream away. When you are done, just press “stop streaming” in OBS.

Bonus step: Adding a custom background poster You may have noticed that the poster video for your live stream was the default image from api.video. If you’d like to change the background image to something more on brand while people wait for your live stream, you just need your liveStreamId and a jpg image:

sql

This will update the poster thumbnail for your video.

Conclusion

Creating and sharing a live video stream might sound like a complicated process, but using api.video we were able to quickly and painlessly create a live stream. With just two API commands, we set up a streaming server that allows us to share our local stream with thousands of users around the world. Then we configured a local application to transmit the data to the server and began our broadcast. don't hestate to reach us on our community or start building right now!

Try out more than 80 features for free

Access all the features for as long as you need.
No commitment or credit card required

Video API, simplified

Fully customizable API to manage everything video. From encoding to delivery, in minutes.

Built for Speed

The fastest video encoding platform. Serve your users globally with 140+ points of presence. 

Let end-users upload videos

Finally, an API that allows your end-users to upload videos and start live streams in a few clicks.

Affordable

Volume discounts and usage-based pricing to ensure you don’t exceed your budget.