×
Community Blog Host and Stream Live Videos with ApsaraVideo Live

Host and Stream Live Videos with ApsaraVideo Live

In this tutorial, you will learn how you can host and stream live videos with Alibaba Cloud ApsaraVideo Live.

ApsaraVideo Live is a live video and audio broadcasting and streaming platform. It allows you to live-stream high-definition video and audio content. The ApsaraVideo Live platform can be accessed and managed using Alibaba Cloud's Management Console, where you can customize your live-streaming media infrastructure. This service is relatively easy to use and enables you to quickly establish a high-quality live video and audio platform.

In this tutorial, you will learn how you can use this service to host and stream live videos.

Prerequisites

Before you can complete the steps outlined in this tutorial, you will need the following:

  • You'll need to have an Alibaba Cloud account and be logged into your account. You need to set up an Alibaba Cloud account with a valid payment method in place to make full use of this tutorial. If you do not have an account, this information is available in a separate video and tutorial.
  • If you want to stream video in China, you'll need to apply for an ICP (Internet Content Provider) License for China. Note that similar requirements apply elsewhere. If you decide to host in another location, you will not need an ICP license, but this is, of course, not recommended for any sites that will predominantly serve the Chinese market. Alibaba Cloud offers free assistance to help you apply for an ICP license. This information is available in a separate video and tutorial. You can also find more information here.
  • Again, if you will be hosting and streaming video in China, you'll need to complete real-name authentication. You can complete the real name authentication form on the Alibaba Cloud console. You will need to have this form filled to be able to host live-streams in Mainland China. To do this, you can go to the Account Center here. There you will need to enter in your passport number to complete the registration form.

1

  • You'll probably also need to have the VLC Player downloaded. Depending on the streaming tool you use, you may need to download the VLC player to play your content (see Section 3). VLC is completely free to download and use, and is available here.
  • You'll need to enable Alibaba Cloud's Streaming Tools. You can do that on the ApsaraVideo Live Console.

Setting up ApsaraVideo Live

Now, follow these steps to set up ApsaraVideo Live:

1. Go to the Management Console, then scroll down to the Media Services section in the Products & Services area of the Management Console. Next, click on ApsaraVideo Live. You will see a screen like the one below.

2

2. Click the checkbox to show that you agree to the LiveVideo Service Agreement.

3. Last, you'll want to click Enable. After doing so, you'll see a screen like the one below.

3

Setting up Your Domain

In this section, you'll add a new domain name to the ApsaraVideo Live platform, bind a CNAME and configure the relevant authentication. There are several ways to apply for a live video domain name. The most common method for Mainland China is to apply at http://www.net.cn , for example. More information on alternative methods is available here: https://www.alibabacloud.com/help/doc-detail/84094.htm . For this, you will need to have the details of your domain available to complete this step.

  • Add a Live Video Domain Name. Next, we need to set up a live video domain name to stream your content on ApsaraVideo Live. For this, follow these steps:

1. Go to the Domains section of the ApsaraVideo Live Console. It will look something like this:

4

2. Select the region where you want your streaming service to be available. Remember, you will need a domain with an ICP license if you want to serve content to Mainland China.

3. Click Add New Domain.

5

4. Enter the Live domain name into the textbox. For this tutorial the live domain name is 'videolive-en.aliyun.com'.

5. Click Next step.

6

  • Bind CNAME to the Domain. Next, we need to modify the DNS and CNAME record of the live video domain name we've just added in the previous step. For this, follow these steps:

1. Copy the CNAME value for the live video domain we've just added from the Console:

7

2. Go to the Domain Console: https://dc.console.aliyun.com .

3. Go to the Domain Name List page, then, when there select the domain name, and click Resolve.

8

Now, we need to bind the streaming address provided by Alibaba Cloud with the live video domain name. This acts as a gateway to push your video stream through to the live video center at the time when it reaches the live video domain name. To do this, continue by following the steps below:

4. Click Add Record.

9

5. Click Add Record again.

10

6. This will bring up a window where you need to add the resolution parameters for the domain. These are:

  • Type: For this, select CNAME from the dropdown list.
  • Host: For this parameter, enter the secondary domain of the streaming address. For example, if the streaming address is videolive-en.aliyun.com, then the secondary domain name is videolive-en.
  • ISP Line: Leave as the Default setting.
  • Value: Paste the CNAME value you copied in step 1 here.
  • TTL: Leave as 10 minute(s).

Configuring Your Authentication Settings

You can either use the default settings to configure the authentication, or customize the authentication. For the purpose of this tutorial, we will go through the default authentication procedure. More information on customization options is available here. The authentication function uses these settings for this example: the authentication function is in the Opened state by default, the Main KEY is abcd1234 and the Expire time is 1800s. This means that the authentication expires if the time exceeds 1800s. For this part, log on to the ApsaraVideo Live Console and complete these steps:

1. Click Domains in the left-side navigation pane, then select the region and the domain name, and then click Detail at the right side.

11

2. In Base Information > Center streaming information, click Go to generate authentication URL at the right side of Authentication settings.

12

3. In the Generate authentication URL page, click Start to generate.

4. Click to copy the generated URL authentication address. Store this in a secure location, you will need it later.

13

5. Click OK.

6. The generated Authentication URL rtmp://video-center.alivecdn.com/AppName/StreamName?vhost=videolive-en.aliyun.com&auth_key=************** can be used for streaming and playback with your chosen streaming tool for the streaming operation.

A Note about the Live Broadcasting Address Structure

A live video service address consists of three levels of live video management units: the domain name (Domain), an application (AppName) and a live-stream (StreamName). You can create multiple apps (AppName) under each domain name (Domain), and multiple live-streams (StreamName) under each app. AppName and StreamName can be edited and customized. Naturally, different values generate different streaming and playback addresses. For example, if an app is named live you can create multiple live-streams under live. The streaming addresses are then as follows:

rtmp://video-center.alivecdn.com/{live}/{3}?vhost={live video domain name}
rtmp://video-center.alivecdn.com/{live}/{1}?vhost={live video domain name}
rtmp://video-center.alivecdn.com/{live}/{2}?vhost={live video domain name}

You can also create multiple live-streams for the app:

rtmp://video-center.alivecdn.com/{live1}/{Stream}?vhost={live video domain name}
rtmp://video-center.alivecdn.com/{live2}/{Stream}?vhost={live video domain name}
rtmp://video-center.alivecdn.com/{live3}/{Stream}?vhost={live video domain name}

Before proceeding, check if you have added a live video domain to the Console, binded a CNAME to the domain, entered the authentication settings, and generated an authentication URL. If you have completed all of this, you can now move to the next section.

Setting up Streaming

In this section, we will give you the information you need to take to step up a live-streaming process. By definition, streaming is the process of transmitting live content to the server using streaming tools and other content capturing software. To stream your content, you need to use a third-party streaming tool. Alibaba Cloud recommends the following streaming tools:

The ApsaraVideo Live platform will sync with your streaming tool so that, when you start to create content, it is automatically generated in the ApsaraVideo Live console. It does this using the authenticated URL information that was generated previously in this tutorial.

Now It's Time for Playing Your Videos

In this section, we will show you how to preview your streaming content from the Alibaba Cloud console:

1. Go to the ApsaraVideo Live Console and click on Streams, then select the region, the domain name, and the stream status.

2. Next, select the streaming address, and click Address at the right side.

14

3. You can then check the playback address and preview the content by clicking Copy and pasting the address into a browser address bar. Alternatively, you can click Play, and the content will play using the VLC Player.

15

4. If you are happy with your preview, copy the URL of the desired quality and format for your live-streaming content and paste it into the URL field of your encoder or browser. You have now created your first piece of streaming content on the Alibaba ApsaraVideo Live platform.

0 0 1
Share on

Alibaba Clouder

2,599 posts | 764 followers

You may also like

Comments