【Live Streaming Series 2】Quick access to PC-side live broadcast function

Abstract:  This article introduces the PC-side live streaming and the quick access method of the player. For the mobile-end streaming and playback, please refer to the official website documentation.

The seemingly complicated live broadcast function can be quickly integrated by opening the Alibaba Cloud live broadcast service.

Calm down and read this article carefully in a few minutes. I believe you will know how to quickly access the PC-side live broadcast function in the Alibaba Cloud live broadcast console.

Live stream
_

Step1: Preparation before live broadcast

Log in to Alibaba Cloud's official website  and click Login in the upper left corner

Log in to the live video console
console to check the activation status of the dependent services, please follow the instructions on the page

**Add live domain name**

domain_1
new_page_1
new_page_12

have to be aware of is:

  • The live broadcast domain name needs to be reviewed and approved, and it can be used after the review. If the domain name has not been registered, please first record and record the process .

  • After the domain name is successfully configured, the CDN live broadcast acceleration function will be automatically configured for this domain name, and the live broadcast acceleration function can be used after the domain name is CNAME bound.

CNAME binding

Modify the DNS CNAME record of the live domain name you added to the CNAME binding address displayed on the live broadcast domain name management details page. We need to bind the push stream address provided by Alibaba Cloud with the live broadcast domain name, so that when the push stream is sent to the live broadcast domain name, it will be pushed to our live broadcast center.

Please follow the steps below to bind the domain name CNAME

Apply for a live domain name on Wanwang

  • Get the CNAME corresponding to the live broadcast domain name of the live broadcast console.
    _

  • Click the domain name resolution page of the Alibaba Cloud official website console, and select the domain name to be bound.
    _

  • Go to the Domain Name Resolution tab and click Advanced Settings.
    _

  • Fill in the parsing parameters and save.

_

  • The resolution will take effect soon. If it is a newly created domain name resolution, there is no DNS refresh problem. If the CNAME is modified, there will be cached data in different DNS, and it may take up to 48 hours to update.

Apply for a live domain name in other ways

  • For domain names applied for by other means, please operate the domain name CNAME binding on the website where the domain name is located.
  • Execute the domain name transfer process on the Alibaba Cloud console.

Get the push stream and playback address

In Domain Name Management, click Live Acceleration Domain Name Management:
_1
_2
_3

Authentication configuration

The push and playback of live streaming media use the same authentication scheme, which can be configured in the authentication configuration of the console. Learn more about the authentication configuration.

Notice

只有进行鉴权配置后,该加速域名才能正常进行推流和播流,直播业务类型仅支持A类型鉴权方式。

推流和播流地址需要分别进行鉴权签名计算,每一个签名都是严格按照URL计算的,故不可使用推流URL计算得到的签名应用到播流地址,同理每一种播流地址都会对应不同的鉴权计算结果。

举例:

在直播控制台 - 域名管理 - 直播域名管理详情页 - 鉴权配置 设置鉴权配置如下:

1、开启鉴权

_

2、手动输入鉴权主key值,详细内容访问 鉴权说明鉴权设置
_key_

Step2:推流

获取鉴权后的推流地址:

直播控制台 - 域名管理 - 直播域名管理详情页 - 基本信息 取得推流地址如下:

rtmp://video-center.alivecdn.com/AppName/StreamName?vhost=live.aliyun.com

使用直播控制台 - 域名管理 - 直播域名管理详情页 - 鉴权配置 页面的鉴权URL计算器计算鉴权URL:

输入推流地址(AppName、StreamName可自行修改)、鉴权KEY、有效时间,点击<生成>按钮即可得到鉴权URL。

_

推流操作

推流地址:

rtmp://video-center.alivecdn.com/APPName/StreamName?vhost=live.aliyun.com

说明

video-center.alivecdn.com是直播中心服务器,允许自定义,例如您的域名是live.aliyun.com(注意:该域名不可以和你的直播加速域名相同),可以设置DNS,将您的域名CNAME指向video-center.alivecdn.com即可。

APPName是应用名称,支持自定义,可以更改。

StreamName是流名称,支持自定义,可以更改。

vhost参数是最终在边缘节点播放的域名,即你的直播加速域名。

直播推流操作可使用第三方推流软件,这里介绍 OBS 推流软件的操作方法。

请到OBS官网下载最新软件 Windows版本 Mac版本

在OBS 设置 中应按下图设置:

_obs_

Mac版推流地址设置:

_mac_

Windows版推流地址设置:

_windows_

实际 Mac版obs的流密钥与Windows版播放路径/串码流(如果存在)中的内容不会显示明文。

以上面的推流地址为例,参数设置为:

FMS URL / URL: rtmp://video-center.alivecdn.com/AppName

播放路径/串码流(如果存在)/ 流秘钥: StreamName?vhost=live.aliyn.com

If you have enabled authentication, the authentication parameters are also placed in the stream key of the Mac version of obs and the playback path/stream (if it exists) of the Windows version.

Step3: Play

Play with that protocol?

Protocol | Advantages | Disadvantages | Delay
------- | ------- | -------
FLV | High concurrency, low delay | -3s
RTMP | Small delay | High concurrency support is not good | 1s-3s
HLS(M3U8) | Mobile browsers generally support | Large delay | >=10s, related to slice duration, maximum 3 TS length

Customers can use it flexibly according to the actual business scenarios. It needs to be played on mobile browsers and mobile H5 terminals. It is recommended to use HLS (M3U8) mode to play, without the need to integrate SDK; non-mobile terminals or integrated SDK, low concurrency and parallel. If a smaller delay is required, RTMP can be used, and FLV is recommended for high concurrency.

Web page background preview directly

After using OBS and other tools to push the stream using the authentication URL, you can query the live streaming record on the Live Streaming Console - Stream Management - Streaming page. You can query the playback address and preview the playback through the live broadcast address.

_web_
_

Preview via VLC

Download VLC, no additional settings are required after the default installation, File -> Open Network Streaming, fill in the playback address and click Open to start playing.

_VLC

If the screenshots seem too tiring, we also recently launched a video demo, click the text below to watch the video

Activate the live broadcast serviceAdd
a live broadcast acceleration domain
nameAdd a live broadcast transcoding templateAdd
a live broadcast screenshot templateAdd
a live broadcast recording template

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327071383&siteId=291194637