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 the features of ApsaraVideo Live. This topic describes how to configure EdgeScript in the ApsaraVideo Live console.
Prerequisites
The EdgeScript service is activated. To activate the service, submit a ticket. For more information, see Contact us.
Background information
Use EdgeScript to manage scripts in one of the following scenarios as needed:
- Create scripts.
- Modify existing scripts.
Create scripts
- Log on to the ApsaraVideo Live console.
- In the left-side navigation pane, click Domains. The Domain Management page appears.
- Find the streaming domain that you want to configure and click Domain Settings.
- Choose Staging Environment tab appears. . The
- Click Create Script. On the Add Script page, configure a script. Note You can create only one script for each domain name. If you want to create multiple scripts for a domain name, submit a ticket.The following table describes the parameters.
Parameter Required Description Script Name Yes Specify a name for the script. The name can contain only letters, digits, and underscores (_). Script Code Yes Enter the code of the script. Priority Yes Specify a priority for the script. Valid values: 0 to 99. A value of 0 specifies the highest priority, and a value of 99 specifies the lowest priority. Run Script At Yes Specify the position in which you want to execute the script. Enable Yes Specify whether to enable the script. Break No Specify whether to skip the subsequent scripts if the current script is matched. After you turn on Break, the subsequent scripts are skipped if the current script is matched.
Extensions No EdgeScript supports extensions. Only _es_dbg=signature
is supported. This field is used to add a response header for debugging.After you configure the script, you can click Open Debugging Tool to perform single request testing. This step is optional.
- Click Publish to Staging Environment. Test the script in the staging environment. The IP address of the test node in the following figure is only for reference. The actual IP address of the test node in the staging environment shall prevail.On your client, find the hosts file in the path C:\Windows\System32\drivers\etc. Add the IP address of the test node to the hosts file.Important
- In a Windows operating system, the path is C:\Windows\System32\drivers\etc\hosts.
- In a macOS operating system, the path is /etc/hosts.
- After you test the script, click Publish All Scripts to Production Environment to publish all scripts from the staging environment to the production environment. Important After you publish the scripts from the staging environment to the production environment, the scripts are automatically deleted from the staging environment.
Modify existing scripts
- Click Roll Back Configurations in the Staging Environment to roll back configurations in the staging environment to the initial status.
- Click Copy Scripts from Production Environment to copy the scripts from the production environment to the staging environment.
- On the Staging Environment tab, find the script that you want to modify. Click Modify in the Actions column to modify the script.
- After you modify 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.
- After you test the script, click Publish All Scripts to Production Environment to publish all scripts from the staging environment to the production environment. Important After you publish the scripts from the staging environment to the production environment, the scripts are automatically deleted from the staging environment.