When do I need to disable stream ingest?

If an ingest URL is leaked, users may use it for malicious stream ingest. In such business scenarios, you must disable the ingest URL. ApsaraVideo Live allows you to disable stream ingest to meet such requirements.

How do I disable stream ingest?

  • Use the ApsaraVideo Live console to disable stream ingest
    • Query an active ingest URL and disable stream ingest

      When a stream is being ingested, you can perform the following steps to query the ingest URL and disable stream ingest: Log on to the ApsaraVideo Live console and choose Stream Management > Ingest Endpoints. On the page that appears, select the domain name that is associated with the live stream and click Search to query the active ingest URLs. Find the ingest URL that you want to disable and click Disable Stream Ingest.

    • Query a historical ingest URL and disable stream ingest

      After you finish ingesting a stream, you can perform the following steps to query the ingest URL and disable stream ingest: Log on to the ApsaraVideo Live console and choose Stream Management > Ingest Endpoints. On the page that appears, click the Activity Log tab, select the domain name that is associated with the live stream, and then click Search to query the ingest URLs. Find the ingest URL that you want to disable and click Disable Stream Ingest.

  • Use an SDK to disable stream ingest

    The ApsaraVideo Live API is developed based on the OpenAPI protocol of Alibaba Cloud. The operations of the ApsaraVideo Live API are also integrated into ApsaraVideo Live SDKs. For more information about how to download server SDKs, see SDK download. For more information about how to use SDKs, see SDK instructions.

    In the following example, the SDK for Java is used to disable stream ingest. To use the SDK for Java, add the following Maven dependencies to the pom.xml file:
    <dependencies>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-cdn</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
            <optional>true</optional>
            <version>2.3.8</version>
        </dependency>
    </dependencies>
                        
    The aliyun-java-sdk-core dependency is the core module that encapsulates Alibaba Cloud APIs. The aliyun-java-sdk-core dependency is required if you want to use various Alibaba Cloud service SDKs for Java. The aliyun-java-sdk-cdn dependency provides the Request and Response classes of ApsaraVideo Live. The Request class for querying the blacklist of ingest URLs is DescribeLiveStreamsBlockListRequest and the corresponding Response class is DescribeLiveStreamsBlockListResponse, as shown in the following sample code:
    public static void main(String[] args) throws Exception {
        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "<accessId>", "<accessKey>");
        DefaultAcsClient client = new DefaultAcsClient(profile);
        DescribeLiveStreamsBlockListResponse res=DescribeLiveStreamsBlockListR(client);
        System.out.println(res.getStreamUrls());
    }
    static DescribeLiveStreamsBlockListResponse DescribeLiveStreamsBlockListR(DefaultAcsClient client) {
        DescribeLiveStreamsBlockListRequest request =new DescribeLiveStreamsBlockListRequest();
        request.setDomainName("<DomainName>");
        DescribeLiveStreamsBlockListResponse response=null;
        try {
            response = client.getAcsResponse(request);
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            e.printStackTrace();
        } 
        return response;
    }
                
    Logic of the sample code
    1. Initialize the Java client.

      The SDK uses IAcsClient to call API operations. When you initialize IAcsClient, set the region, AccessKeyId, and AccessKeySecret parameters based on the IClientProfile class. The region parameter specifies the region where the API server resides. Set this parameter to cn-hangzhou. The AccessKeyId and AccessKeySecret parameters are used for user authentication. You can use the AccessKey ID and AccessKey secret of an Alibaba Cloud account. If you use the AccessKey ID and AccessKey secret of a RAM user, make sure that the RAM user has the permission to use ApsaraVideo Live.

    2. Initialize the Request class.

      The SDK provides Request and Response classes for each operation. For more information about the request parameters for disabling stream ingest, see ForbidLiveStream.

    3. Initiate a request and obtain the response.

      Call the getAcsResponse method of IAcsClient to initiate a request and instantiate the returned deserialized results to the parameters of the Response class. This method also supports the ServerException and ClientException classes.

      • If an HTTP status code greater than or equal to 300 but less than 500 is returned, the SDK throws ClientException, which indicates a client error.
      • If an HTTP status code greater than or equal to 500 is returned, the SDK throws ServerException, which indicates a server error.
      • If the SDK throws no exception, the operation is successfully called.

How do I query the blacklist of ingest URLs?

  • Use the ApsaraVideo Live console to query the blacklist of ingest URLs

    After you disable stream ingest for a live stream, you can perform the following steps to query the blacklist of ingest URLs: Log on to the ApsaraVideo Live console and choose Stream Management > Ingest Endpoints. On the page that appears, select the domain name that is associated with the live stream, click the Ingest Endpoints (Disabled) tab, and then click Search to query the blacklist.

  • Use an SDK to query the blacklist of ingest URLs

    The ApsaraVideo Live API is developed based on the OpenAPI protocol of Alibaba Cloud. The operations of the ApsaraVideo Live API are also integrated into ApsaraVideo Live SDKs. For more information about how to download server SDKs, see SDK download. For more information about how to use SDKs, see SDK instructions.

    In the following example, the SDK for Java is used to disable stream ingest. To use the SDK for Java, add the following Maven dependencies to the pom.xml file:
    <dependencies>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-cdn</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
            <optional>true</optional>
            <version>2.3.8</version>
        </dependency>
    </dependencies>
                        
    The aliyun-java-sdk-core dependency is the core module that encapsulates Alibaba Cloud APIs. The aliyun-java-sdk-core dependency is required if you want to use various Alibaba Cloud service SDKs for Java. The aliyun-java-sdk-cdn dependency provides the Request and Response classes of ApsaraVideo Live. The Request class for querying the blacklist of ingest URLs is DescribeLiveStreamsBlockListRequest and the corresponding Response class is DescribeLiveStreamsBlockListResponse, as shown in the following sample code:
    public static void main(String[] args) throws Exception {
        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "<accessId>", "<accessKey>");
        DefaultAcsClient client = new DefaultAcsClient(profile);
        DescribeLiveStreamsBlockListResponse res=DescribeLiveStreamsBlockListR(client);
        System.out.println(res.getStreamUrls());
    }
    static DescribeLiveStreamsBlockListResponse DescribeLiveStreamsBlockListR(DefaultAcsClient client) {
        DescribeLiveStreamsBlockListRequest request =new DescribeLiveStreamsBlockListRequest();
        request.setDomainName("<DomainName>");
        DescribeLiveStreamsBlockListResponse response=null;
        try {
            response = client.getAcsResponse(request);
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            e.printStackTrace();
        } 
        return response;
    }
                
    Logic of the sample code
    1. Initialize the Java client.

      The SDK uses IAcsClient to call API operations. When you initialize IAcsClient, set the region, AccessKeyId, and AccessKeySecret parameters based on the IClientProfile class. The region parameter specifies the region where the API server resides. Set this parameter to cn-hangzhou. The AccessKeyId and AccessKeySecret parameters are used for user authentication. You can use the AccessKey ID and AccessKey secret of an Alibaba Cloud account. If you use the AccessKey ID and AccessKey secret of a RAM user, make sure that the RAM user has the permission to use ApsaraVideo Live.

    2. Initialize the Request class.

      The SDK provides Request and Response classes for each operation. For more information about the request parameters for querying the blacklist of ingest URLs, see DescribeLiveStreamsBlockList.

    3. Initiate a request and obtain the response.

      Call the getAcsResponse method of IAcsClient to initiate a request and instantiate the returned deserialized results to the parameters of the Response class. This method also supports the ServerException and ClientException classes.

      • If an HTTP status code greater than or equal to 300 but less than 500 is returned, the SDK throws ClientException, which indicates a client error.
      • If an HTTP status code greater than or equal to 500 is returned, the SDK throws ServerException, which indicates a server error.
      • If the SDK throws no exception, the operation is successfully called.

How do I remove an ingest URL from the blacklist?

  • Use the ApsaraVideo Live console to remove an ingest URL from the blacklist.

    After you disable stream ingest for a live stream, you can perform the following steps to remove the ingest URL from the blacklist: Log on to the ApsaraVideo Live console and choose Stream Management > Ingest Endpoints. On the page that appears, select the domain name that is associated with the live stream, click the Ingest Endpoints (Disabled) tab, and then click Enable.

  • Use an SDK to remove an ingest URL from the blacklist

    The ApsaraVideo Live API is developed based on the OpenAPI protocol of Alibaba Cloud. The operations of the ApsaraVideo Live API are also integrated into ApsaraVideo Live SDKs. For more information about how to download server SDKs, see SDK download. For more information about how to use SDKs, see SDK instructions.

    In the following example, the SDK for Java is used to disable stream ingest. To use the SDK for Java, add the following Maven dependencies to the pom.xml file:
    <dependencies>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-cdn</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
            <optional>true</optional>
            <version>2.3.8</version>
        </dependency>
    </dependencies>
                        
    The aliyun-java-sdk-core dependency is the core module that encapsulates Alibaba Cloud APIs. The aliyun-java-sdk-core dependency is required if you want to use various Alibaba Cloud service SDKs for Java. The aliyun-java-sdk-cdn dependency provides the Request and Response classes of ApsaraVideo Live. The Request class for querying the blacklist of ingest URLs is DescribeLiveStreamsBlockListRequest and the corresponding Response class is DescribeLiveStreamsBlockListResponse, as shown in the following sample code:
    public static void main(String[] args) throws Exception {
        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "<accessId>", "<accessKey>");
        DefaultAcsClient client = new DefaultAcsClient(profile);
        DescribeLiveStreamsBlockListResponse res=DescribeLiveStreamsBlockListR(client);
        System.out.println(res.getStreamUrls());
    }
    static DescribeLiveStreamsBlockListResponse DescribeLiveStreamsBlockListR(DefaultAcsClient client) {
        DescribeLiveStreamsBlockListRequest request =new DescribeLiveStreamsBlockListRequest();
        request.setDomainName("<DomainName>");
        DescribeLiveStreamsBlockListResponse response=null;
        try {
            response = client.getAcsResponse(request);
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            e.printStackTrace();
        } 
        return response;
    }
                
    Logic of the sample code
    1. Initialize the Java client.

      The SDK uses IAcsClient to call API operations. When you initialize IAcsClient, set the region, AccessKeyId, and AccessKeySecret parameters based on the IClientProfile class. The region parameter specifies the region where the API server resides. Set this parameter to cn-hangzhou. The AccessKeyId and AccessKeySecret parameters are used for user authentication. You can use the AccessKey ID and AccessKey secret of an Alibaba Cloud account. If you use the AccessKey ID and AccessKey secret of a RAM user, make sure that the RAM user has the permission to use ApsaraVideo Live.

    2. Initialize the Request class.

      The SDK provides Request and Response classes for each operation. For more information about the request parameters for removing an ingest URL from the blacklist, see ResumeLiveStream.

    3. Initiate a request and obtain the response.

      Call the getAcsResponse method of IAcsClient to initiate a request and instantiate the returned deserialized results to the parameters of the Response class. This method also supports the ServerException and ClientException classes.

      • If an HTTP status code greater than or equal to 300 but less than 500 is returned, the SDK throws ClientException, which indicates a client error.
      • If an HTTP status code greater than or equal to 500 is returned, the SDK throws ServerException, which indicates a server error.
      • If the SDK throws no exception, the operation is successfully called.