Try Live Demo

Today, we are going to walk you through the steps of how to get started with your first stream from Ant Media Server on DigitalOcean. DigitalOcean is a cloud service provider where you can host and run your servers.

Create an Ant Media Server Instance

DigitalOcean has many options to offer for hosting your server, such as bare metal instances, droplets, etc. In this blog, we will create an hourly priced droplet with the one-click install for Ant Media Server on the marketplace.

Ant Media Server on Digital Ocean Marketplace

 

Click on create droplet button and continue with the selection of instances. The critical thing here is, that video encoding is a CPU-intensive process. Therefore, a dedicated CPU should be chosen instead of a shared CPU. As DigitalOcean also suggests, shared CPU machines are basic virtual machines with shared resources and they should be used in small projects like blogs.

Create Droplet

Screenshot from 2021 03 23 14 17 27

 

The best choice is CPU-Optimized Dedicated CPU machines because we will do lots of video encoding in a media server.

Then we choose the instance type according to the needs, Ant Media Server can run in almost any type of instance, the difference will be the number of broadcasters and viewers. For the limits, you may check out; https://antmedia.io/cost-calculator .

Configure the region and instance as you want, we won’t need VPC for a single instance in this post.

Screenshot from 2021 03 23 14 29 18

 

 

Create an SSH key on the DigitalOcean droplet

We need an SSH key or root password for connecting the instance. To add an SSH key to the DigitalOcean, first, we need to generate one. Copy the following command to the terminal;

ssh-keygen

Then the name and a passphrase will be asked, configure them however you want to. Then there will be 2 files created under ~/.ssh folder which are id_rsa and id_rsa.pub. Copy the content of id_rsa.pub from;

cat ~/.ssh/id_rsa.pub

Then paste it to the DigitalOcean ssh as below.

Screenshot from 2021 03 23 14 44 46

 

Create Instance

Screenshot from 2021 03 23 14 54 21

 

Then if the instance is created successfully, you can directly go to your management panel by using http://<instance_IP>:5080 ;

 

Ant Media Server Web Panel - Creating account

It’s done! The instance is up and running. Create your account and log in to the dashboard to test the features!

Browsers ask for SSL if we try to publish with webRTC, to enable SSL for Ant Media Server, check out the references below.

For testing purposes, you can use chrome’s insecure origin treated as a secure option from ‘ chrome://flags/#unsafely-treat-insecure-origin-as-secure ‘ and start your broadcast on:

http://<your_instance_IP>:5080/LiveApp/index.html

Screenshot from 2021 03 23 15 39 43

 

You can watch the broadcast with only 0.5 seconds latency from

http://<your_instance_IP>:5080/LiveApp/player.html

Ant Media Server WebRTC Play

I hope you enjoy Ant Media Server!

 

If you decide to continue using Ant Media Server you can check these useful blogs and documentation;

Enable SSL for Ant Media Server -> https://antmedia.io/enable-ssl-on-ant-media-server/

Ant Media WebRTC Mobile SDKs -> https://github.com/ant-media/Ant-Media-Server/wiki/WebRTC-SDKs

Ant Media Security Options -> https://github.com/ant-media/Ant-Media-Server/wiki

Categories: Tutorial

tahir.golge

Tahir Ahmet Gölge is a full-stack software developer at Ant Media. He mainly implements new features and works on the bugs that may appear in the software for both back-end and front-end, also he helps the technical support and sales. He has around 2 years of experience in video engineering, server (REST, spring, tomcat, etc. ) development and testing, and live streaming platforms to create solutions for ultra-low latency streaming.