tencent cloud

云直播

动态与公告
公告
新手指南
产品简介
产品概述
子产品简介
基本概念
产品功能
应用场景
产品优势
使用限制
购买指南
计费概述
基础服务费
增值服务费
预付费资源包
购买流程
计费变更
退款说明
账单查询
续费说明
欠费停服说明
计费常见问题
标准直播
概述
应用场景
快速入门
SDK 接入说明
快直播(超低延时直播)
概述
快直播和标准直播区别
应用场景
快速入门
SDK 接入说明
云导播台
概述
应用场景
功能区介绍
云导播台管理
通用云导播
配置节目单和自动导播
控制台指南
控制台介绍
概览
域名管理
流管理
资源包管理
AI 智能
功能配置
拉流转推
计费用量
业务监控
常用工具
无忧直播
CAM 访问控制
功能实践
直播推流与播放
直播增值功能
典型场景实践
云端原生录制
直播安全
海外直播
回调事件消息通知
常见第三方工具指南
SDK 实践
0. SDK 接入引导
1. 推流
2. 播放
3. 高级功能
API 文档
History
Introduction
API Category
Making API Requests
Live Pad APIs
Live Stream Mix APIs
Time Shifting APIs
Monitoring Data Query APIs
Billing Data Query APIs
Live Transcoding APIs
Delayed Playback Management APIs
Domain Name Management APIs
Watermark Management APIs
Certificate Management APIs
Stream Pulling APIs
Recording Management APIs
Live Callback APIs
Screencapturing and Porn Detection APIs
Authentication Management APIs
Live Stream Management APIs
Data Types
Error Codes
运维指南
优化视频卡顿
推流失败问题排查
播放失败问题排查
CLS 协助直播问题排查
直播延迟问题排查
拉流视频质量不清晰问题排查
COS bucket 授权给直播实现截图存储
故障处理
直播混流报错:InvalidParameter.OtherError
常见问题
服务地区相关
直播基础相关
推流播放相关
直播计费相关
直播海外相关
直播录制相关
云端混流相关
域名配置相关
云导播台相关
适配苹果 ATS 相关
服务等级协议
云直播服务等级协议
CSS 政策
隐私协议
数据处理和安全协议
词汇表
文档云直播

Quick URL Generation

聚焦模式
字号
最后更新时间: 2022-03-14 14:37:06

1. How to Get URL Quickly

If you want to generate a group of URLs for testing, you only need to open CSS Console > CSS Code Access > Push Generator, and click Generate Push URL button, to generate a push URL and three playback URLs with different playback protocols.

img



2. How to Realize Auto Construction at the Backend

2.1 Push URL

In the actual application scenario, it is impossible to create push and playback URLs manually for each VJ. Instead, these URLs are constructed automatically by your server. Any URL that conforms to Tencent Cloud specifications can be used as a push URL. A standard push URL is shown below, which consists of three parts:
url


CSS Code It is also called room ID. Random numbers or user ID is recommended. BIZID prefix is required in a valid CSS code.
txTime It refers to the time when the URL expires. The format is UNIX time stamp in hexadecimal notation, for example, 5867D600 means that the URL will expire at 00:00:00 AM on Jan. 1, 2017. Generally, txTime is set to a time which is 24 hours later than the current time. It is not recommended to set a too short validity period to avoid the inability of VJ to restore push in case of a flash breakdown of network during the broadcasting.
txSecret This refers to hotlink protection signature, which is used to prevent attackers from simulating your backend server to generate push URL. For more information about computing method, please see Computing of Hotlink Protection.
Sample Code Go to CSS Console > CSS Code Access > Push Generator. In the lower part of the page, the sample code (PHP and Java) is provided to show how to generate a hotlink protection URL.

2.2 Playback URL

Constructing a playback URL is as simple as constructing a push URL, except that the sub-domain name needs to be changed from livepush to liveplay:
img


The security hotlink protection refers to the txSecret field in push and playback URLs. It is used to prevent attackers from simulating your backend server to generate push URL or hacking your playback URL for their benefits.

3.1 How it works

To prevent attackers from simulating your server to generate push URL, you need to configure in CSS console a hotlink protection encryption key that is unlikely to be obtained by attackers for faking a valid push URL. The figure below shows how it works.
img



3.2 Computing procedure

Step 1: Exchange the key You need to negotiate an encryption key on the console at the official website. This encryption key is used to generate a hotlink protection signature on your server. Since Tencent Cloud has the same key as yours, it can decrypt and verify the hotlink protection signature generated by your server.
Encryption keys are classified into push hotlink protection keys and playback hotlink protection keys. The former are used to generate the push hotlink protection URLs and the latter are used to generate the playback hotlink protection URLs. You can configure push hotlink protection keys in the CSS Console, as shown below:

Playback hotlink protection is disabled by default:
Since the configuration of playback hotlink protection key needs to be synchronized to thousands of CDN clusters, the key cannot be frequently modified in the debugging phase due to a long synchronization period. Contact us if you need to configure the playback hotlink protection by calling our customer service. It generally takes 1 to 3 days to complete the synchronization in all of the clusters.
Step 2: Generate txTime In the signature, the plaintext is txTime, which indicates the URL validity period. For example, if the current time is 2016-07-29 11:13:45 and the generated URL is expected to expire after 24 hours, txTime can be set to 2016-07-30 11:13:45.
Such a long time string would occupy too much space in the URL. In actual scenario, 2016-07-30 11:13:45 is converted into a UNIX timestamp, i.e. 1469848425 (various backend programming languages are directly handled by available time functions during the conversion). Then, the timestamp is converted into a hexadecimal string to further reduce the string length, that is, txTime = 1469848425 (hexadecimal) = 579C1B69 (hexadecimal).
Generally, txTime is set to a time which is 24 hours later than the current time. It is not recommended to set a too short validity period to avoid the inability of VJ to restore push in case of a flash breakdown of network during the broadcasting.
Step 3: Generate txSecret txSecret is generated as follows: txSecret = MD5 (KEY + stream_id + txTime). The KEY here is the encryption key you configured in Step 1. In this example, stream_id is 8888_test001, txTime is 579C1B69 as calculated above, and MD5 is the standard unidirectional irreversible hash algorithm.
Step 4: Construct the hotlink protection URL Combine the push (or playback) URL, the txTime indicating the expiration time of the URL and the txSecret that can be decrypted and verified only by Tencent Cloud to generate a secure hotlink protection URL.

3.3. Sample codes

Go to CSS Console > CSS Code Access > Push Generator. In the lower part of the page, the sample code (PHP and Java) is provided to show how to generate a hotlink protection URL.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈