Overview

This topic describes how to obtain the streaming URL of a live stream and generate a signed streaming URL.

Obtain a streaming URL

  • Use the console
    • URL Generators page

      In the ApsaraVideo Live console, choose Streaming Management > URL Generators. On the page that appears, generate a streaming URL. For more information, see URL generator.

    • Stream Management page

      In the ApsaraVideo Live console, choose Streaming Management > Streams. On the page that appears, click View URLs for a stream to view its streaming URLs of transcoded streams in various formats.

      002
  • Use the concatenating rules

    You can manually construct a streaming URL by using the concatenating rules. For more information, see Ingest and streaming URLs.

Obtain a signed streaming URL

The validity period of signed URLs from ApsaraVideo Live is short. To obtain a signed URL with a longer validity period, you can use a tool or an algorithm.

  • Use a tool in the console

    You can use a tool in the ApsaraVideo Live console to generate a signed streaming URL. For more information, see Configure URL signing.

  • Use an algorithm
    You can construct an unsigned streaming URL based on the AppName and StreamName parameters in an ingest URL. Example: rtmp://videolive.aliyuntest.club/AppName1/StreamName1. Then, you can calculate a signed streaming URL by using the authentication algorithm. For more information, see Construct a signed URL. The following sample PHP code provides an example:
    //http://DomainName/Filename?auth_key=timestamp-rand-uid-md5hash
    //sstring = "URI-Timestamp-rand-uid-PrivateKey" (The URI specifies the relative address that points to the requested resource, 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";
    }
                        

Use code to obtain a streaming URL

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

You can construct a signed URL by using the concatenating rules. For more information, see Construct a signed URL. You can also use an algorithm to obtain a signed URL. The following sample code provides an example on how to calculate the signed URL for a streaming URL, such as rtmp://live8.aliyuntest.club/AppName1/StreamName1, based on the authentication algorithm.

//http://DomainName/Filename?auth_key=timestamp-rand-uid-md5hash
//sstring = "URI-Timestamp-rand-uid-PrivateKey" (The URI specifies the relative address that points to the requested resource, 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";
}
            

What to do if a streaming URL cannot be used for normal playback

Scenario

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

Troubleshooting

  • Check whether the domain name is configured for live streaming.

    Log on to the ApsaraVideo Live console, and check whether you can find the domain name on the Domains page.

  • Check whether the stream ingest is successful. For more information, see What do I do if stream ingest fails?.
  • Check whether the acceleration for live streaming is successful.

    Check whether a CNAME record for the domain name is added at the DNS service provider to map the domain name to the CNAME that is assigned by ApsaraVideo Live. For more information, see Configure a CNAME record. You can obtain the CNAME that is assigned to the domain name on the Domains page of the ApsaraVideo Live console. The CNAME is displayed in the CNAME column of the domain name.

    CNAME
  • Check whether the streaming URL is valid. For more information, see Obtain a streaming URL .
  • Check whether URL signing is enabled for the domain name.

    For information about how to determine whether the streaming URL is signed, see Ingest and streaming URLs.

  • Check whether URL signing is enabled for the domain name and whether the streaming URL is expired. You can generate a new signed URL and check whether it can be used for playback.
  • Check whether the player supports the video format. You can use VLC media player to check whether the video can be played.