CDN Stream Playing, Recording, and Screenshot Authentication
Overview
To prevent attackers from stealing your URL address to use elsewhere, or forging your server to generate URL addresses, resulting in losses, you can configure CDN playing, recording, and screenshot authentication through the ZEGO Console. After enabling authentication, you need to splice the relevant authentication parameters in the URL address; otherwise, you cannot use the relevant services.
- After you configure playing, recording, and screenshot authentication from the ZEGO Console, please keep KEY properly and do not disclose it easily, to prevent attackers from obtaining it and causing losses.
- If you are relaying streams to CDN via RTC or stream mixing, ZEGO servers will automatically generate and splice the URL address parameters for you, and you do not need to generate them yourself; if you are publishing streams through a third-party platform, you need to generate and splice the relevant parameters yourself.
Generate Authentication URL
Playing Authentication
Generate Authentication Key
Please go to the ZEGO Console, find "Playing Authentication" in your "Project Configuration > Service Management > Live Streaming", enable authentication, and configure or automatically generate the playing authentication KEY in the input box.

Among them, the primary KEY is required and the backup KEY is optional. We recommend that you configure both the primary KEY and the backup KEY. If the primary KEY is leaked, you can smoothly switch to the backup KEY without affecting your business use.
Generate wsABStime
wsABStime refers to the validity period of the URL address. It is calculated in the same way as txTime. After converting to hexadecimal, note that it must be in uppercase.
For example, if the current time is 2018-12-29 11:13:45 and you expect the newly generated URL to expire after 3 hours, then:
- wsABStime can be set to 2018-12-29 14:13:45.
- Then convert the time to Unix timestamp format (i.e., 1546064025).
- Then convert it to hexadecimal, getting wsABStime = 5C271099 (hexadecimal, note that it must be in uppercase).
Generate wsSecret
The generation method of wsSecret is wsSecret = MD5(wsABStime + StreamName + KEY).
Where:
- wsABStime: hexadecimal timestamp, such as 5C271099.
- StreamName: path in the format of
/access point/streamID, such as/live/streamid123. - KEY: authentication key.
- MD5: standard MD5 one-way irreversible hash algorithm.
Complete example:
wsSecret = MD5(5C271099/live/streamid123KEY123)Get URL Address
The anti-leeching URL is generated by appending the authentication parameters to the end of the original URL as query parameters. After completing the above steps, the final URL format is as follows:
rtmp://xxx.xx.xx/{path}?wsSecret={wsSecret}&wsABStime={wsABStime}
The following is an example (the sample URL is for format reference only, please do not use it directly in the production environment):
rtmp://play-ws1.zego.im/live/123?wsSecret=235cec79bf9483439762ddfd491387e2&wsABStime=5C271099Recording and Screenshot Authentication
Generate Authentication Key
Please go to the ZEGO Console, find "Recording and Screenshot Configuration" in your "Project Configuration > Service Configuration > ZEGO CDN", enable authentication, and configure or automatically generate the recording and screenshot authentication KEY in the pop-up dialog.
| Recording Authentication Example | Screenshot Authentication Example |
|---|---|
![]() | ![]() |
Among them, the primary KEY is required and the backup KEY is optional. We recommend that you configure both the primary KEY and the backup KEY. If the primary KEY is leaked, you can smoothly switch to the backup KEY without affecting your business use.
Generate wsABStime
wsABStime refers to the validity period of the URL address. It is calculated in the same way as the wsABStime for playing authentication.
wsABStime = 5C271099Generate wsSecret
The generation method of wsSecret is wsSecret = MD5(wsABStime + uri + KEY).
Where:
- wsABStime: hexadecimal timestamp, such as 5C271099.
- uri: uniform resource identifier, such as
/123.flv. - KEY: authentication key.
- MD5: standard MD5 one-way irreversible hash algorithm.
Complete example:
wsSecret = MD5(5C271099/123.flvKEY123)Get URL Address
The anti-leeching URL is generated by appending the authentication parameters to the end of the original URL as query parameters. After completing the above steps, the final URL format is as follows:
http://xxx.xx.xx/{path}/{filename}.flv?wsSecret={wsSecret}&wsABStime={wsABStime}
The following is an example (the sample URL is for format reference only, please do not use it directly in the production environment):
http://example.com/record/123.flv?wsSecret=235cec79bf9483439762ddfd491387e2&wsABStime=5C271099

