Initial configuration

To perform live streaming, enable Alibaba Cloud CDN acceleration, add a domain to the ApsaraVideo Live console, and then ingest a stream. For more information, see Quick Start.

FAQ

How do I obtain a streaming URL?

How do I obtain a signed streaming URL?

The validity period of signed URLs provided by the ApsaraVideo Live console is short. If you need to obtain a signed URL with a longer validity period, you can use a small tool or an algorithm.

  1. Use a small tool in the ApsaraVideo Live console

    1. Log on to the ApsaraVideo Live console and click Domains in the left-side navigation pane.

    2. On the Domains page, click Domain Settings in the Actions column of the target domain.

    3. On the domain configuration page, click Access Control. On the page that appears, click the URL Authentication tab.

    4. On the URL Authentication tab, set parameters for generating signed URLs. For more information, see Configuration authentication.

  • Set the validity period for the singed URL. The signed URL is unavailable after it expires. The default validity period of type A authentication is 1,800 seconds. If you set the validity period for the singed URL to 3,000 seconds, the signed URL expires 4,800 seconds after the specified timestamp.
  1. Use code to obtain a signed streaming URL

    You can construct an unsigned streaming URL based on the AppName and StreamName parameters in the ingest URL. For example, the constructed streaming URL is rtmp://videolive.aliyuntest.club/AppName1/StreamName1. Then, calculate a signed streaming URL by using the authentication algorithm code. For more information, see Configuration authentication. You can use the following sample PHP code to calculate a signed URL:

    //http://DomainName/Filename?auth_key=timestamp-rand-uid-md5hash
    //sstring = "URI-Timestamp-rand-uid-PrivateKey" (The URI specifies the address that points to the requested resource. It does not contain parameters such as /Filename.)
    //HashValue = md5sum(sstring)
    function PrivateKeyA(){
    $time=strtotime("-800 seconds");//("+1 hours");
    $key="aliyun2013";
    $domain="rtmp://videolive.aliyuntest.club";
    $filename="/AppName1/StreamName1";
    //$sstring = "URI-Timestamp-rand-uid-PrivateKey" 
    $sstring = $filename."-".$time."-0-0-".$key;
    $md5=md5($sstring);
    $auth_key="auth_key=".$time."-0-0-".$md5;
    $url=$domain.$filename."?".$auth_key;
    echo $url."\n";
    }
    					

How do I use code to obtain a streaming URL?

You can construct a streaming URL based on the AppName and StreamName parameters in an ingest URL. For example, if an ingest URL is rtmp://video-center.alivecdn.com/APPName1/StreamName1? vhost=videolive.aliyuntest.club, its streaming URL is rtmp://videolive.aliyuntest.club/AppName1/StreamName1.

You can construct an unsigned streaming URL based on the AppName and StreamName parameters in the ingest URL. For example, the constructed streaming URL is rtmp://live8.aliyuntest.club/AppName1/StreamName1. Then, calculate a signed streaming URL by using the authentication algorithm code. For more information, see Configuration authentication. You can use the following sample PHP code to calculate a signed URL:

//http://DomainName/Filename?auth_key=timestamp-rand-uid-md5hash
//sstring = "URI-Timestamp-rand-uid-PrivateKey" (The URI specifies the address that points to the requested resource. It does not contain parameters such as /Filename.)
//HashValue = md5sum(sstring)
function PrivateKeyA(){
    $time=strtotime("-800 seconds");//("+1 hours");
    $key="aliyun2013";
    $domain="rtmp://videolive.aliyuntest.club";
    $filename="/AppName1/StreamName1";
    //$sstring = "URI-Timestamp-rand-uid-PrivateKey" 
    $sstring = $filename."-".$time."-0-0-".$key;
    $md5=md5($sstring);
    $auth_key="auth_key=".$time."-0-0-".$md5;
    $url=$domain.$filename."?".$auth_key;
    echo $url."\n";
}
			

Why am I unable to use a streaming URL for live streaming?

Scenario

After a stream is ingested to a streaming URL, the streaming URL cannot be used to play the stream.

Troubleshooting

  • Perform the following steps to check whether the corresponding domain is configured for live streaming: Log on to the ApsaraVideo Live console and click Domains in the left-side navigation pane. On the Domains page, check whether you can find the target domain.

  • Check whether the stream ingest is successful.

  • Check whether the assigned canonical name (CNAME) record is bound to the domain. For more information, see Configure a CNAME record in Alibaba Cloud DNS. To obtain the CNAME record, log on to the ApsaraVideo Live console and click Domains in the left-side navigation pane. On the Domains page, click Domain Settings in the Actions column. On the page that appears, you can find the CNAME record on the Basic Information tab.

  • Check whether the streaming URL is correct.

  • Check whether URL signing is enabled for the domain and whether the streaming URL is a signed URL. For more information, see Ingest URL and streaming URL (Original) and Ingest URL and streaming URL (Encoding).

  • Check whether URL signing is enabled for the domain and whether the streaming URL has expired. You can regenerate a signed URL for playback testing.

  • Check whether the player supports playing live streams of the corresponding format. You can use VLC media player to check whether the live stream can be played.