In the ApsaraVideo Live console, you can create scripts based on the EdgeScript coding standard and publish the scripts to the production environment. This way, you can customize your ApsaraVideo Live service. This topic shows you how to use EdgeScript to create a script in the ApsaraVideo Live console.
- Log on to the ApsaraVideo Live console.
- In the left-side navigation pane, click Domains to go to the Domain Management page.
- Select the streaming domain that you want to configure and click Domain Settings.
- Choose Staging Environment tab appears. . The
- Click Add Rule. On the Add Script page, configure a script. Note You can create only one script for each domain name. To create more scripts for a domain name, submit a ticket.The following table describes the parameters.
Parameter Required Description Script Name Yes The name of the script. The name can contain letters, digits, and underscores (_). Script Code Yes The code of the script.
For more information about how to write script code, see EdgeScript manual.
For more information about the sample code provided by ApsaraVideo Live based on scenarios, see Scenarios.
Priority Yes The priority of the script. Valid values: 0 to 99. A greater value indicates a higher priority. Run Script At Yes The position where the script is executed. Valid values: Head and Foot. For more information, see Positions and priorities. Enable Yes Specifies whether to enable the script. Break No Specifies whether to skip the subsequent scripts if the current script is executed.
Assume that you turn on this switch. If the current script is executed, the subsequent scripts are skipped.
Extensions No EdgeScript supports extensions. You can set this parameter to
_es_dbg=signatureto perform response header debugging.
After you configure the script, you can click Open Debugging Tool to perform single request testing.
- Click Publish to Staging Environment.
- Test the script in the staging environment. The following figure shows how to check the IP address of the client for testing scripts in the staging environment.
On your client, find the hosts file under the path C:\Windows\System32\drivers\etc. Add the IP address of the test client to the hosts file.
- After you test the script, click Publish All Rules to Production Environment to publish all scripts from the staging environment to the production environment.
Notice After you publish a script from the staging environment to the production environment, the script in the staging environment is automatically cleared.
- To modify scripts that you have published to the production environment, you must
copy the scripts from the production environment to the staging environment, and then
modify the scripts. Click Copy Rules from Production Environment to copy the scripts from the production environment to the staging environment.
After you copy a script from the production environment to the staging environment, you can modify the copied script in the staging environment.