FAQ about disabling stream ingest

Updated at:
Copy as MD

When to disable stream ingest

You can disable stream ingest in ApsaraVideo Live to meet security requirements. This is useful when an authenticated ingest URL is exposed, malicious stream ingest is detected, or business requirements prohibit ingest for a specific URL.

Disable stream ingest

  • Disable stream ingest on the ApsaraVideo Live console

    • Find and disable an active ingest URL

      Once a stream is active, go to the ApsaraVideo Live console and navigate to the Streams page. Select the desired domain name, click Search, find the active live stream, and then click Disable.

      In the Actions column, click the more icon (⋮) to open a menu where you can select Interrupt Stream and Live Clipping.

    • Find and disable a historical ingest URL

      After a stream ends, go to the ApsaraVideo Live console and navigate to the Streams page. Click the Stream History tab, select the domain name, and click Search. Find the desired stream and click Disable.

  • Disable stream ingest using an SDK

    ApsaraVideo Live APIs are based on Alibaba Cloud OpenAPI. The provided SDKs wrap these API calls. To download the server-side SDK, see server-side SDK. For usage instructions, see SDK instructions.

    If you use the Java SDK, add the following Maven dependency to your pom.xml file:

    <dependency>
      <groupId>com.aliyun</groupId>
      <artifactId>alibabacloud-live20161101</artifactId>
      <version>2.0.0</version>
    </dependency>
    Note

    The SDK version is for reference only. For the latest version, see server-side SDK.

    The main workflow of the sample code is as follows:

    1. Initialize the Client object.

      The SDK uses an AsyncClient object to call API operations.

    2. Initialize the Request class.

      The SDK provides Request and Response classes for each API operation. For details on the request parameters, see the ForbidLiveStream API reference.

    3. Send the request and retrieve the result.

    Sample code:

    // This file is auto-generated, don't edit it. Thanks.
    package demo;
    
    import com.aliyun.auth.credentials.Credential;
    import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
    import com.aliyun.core.http.HttpClient;
    import com.aliyun.core.http.HttpMethod;
    import com.aliyun.core.http.ProxyOptions;
    import com.aliyun.httpcomponent.httpclient.ApacheAsyncHttpClientBuilder;
    import com.aliyun.sdk.service.live20161101.models.*;
    import com.aliyun.sdk.service.live20161101.*;
    import com.google.gson.Gson;
    import darabonba.core.RequestConfiguration;
    import darabonba.core.client.ClientOverrideConfiguration;
    import darabonba.core.utils.CommonUtil;
    import darabonba.core.TeaPair;
    
    //import javax.net.ssl.KeyManager;
    //import javax.net.ssl.X509TrustManager;
    import java.net.InetSocketAddress;
    import java.time.Duration;
    import java.util.*;
    import java.util.concurrent.CompletableFuture;
    import java.io.*;
    
    public class ForbidLiveStream {
        public static void main(String[] args) throws Exception {
    
            // HttpClient Configuration
            /*HttpClient httpClient = new ApacheAsyncHttpClientBuilder()
                    .connectionTimeout(Duration.ofSeconds(10)) // Set the connection timeout time, the default is 10 seconds
                    .responseTimeout(Duration.ofSeconds(10)) // Set the response timeout time, the default is 20 seconds
                    .maxConnections(128) // Set the connection pool size
                    .maxIdleTimeOut(Duration.ofSeconds(50)) // Set the connection pool timeout, the default is 30 seconds
                    // Configure the proxy
                    .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("<YOUR-PROXY-HOSTNAME>", 9001))
                            .setCredentials("<YOUR-PROXY-USERNAME>", "<YOUR-PROXY-PASSWORD>"))
                    // If it is an https connection, you need to configure the certificate, or ignore the certificate(.ignoreSSL(true))
                    .x509TrustManagers(new X509TrustManager[]{})
                    .keyManagers(new KeyManager[]{})
                    .ignoreSSL(false)
                    .build();*/
    
            // Configure Credentials authentication information, including ak, secret, token
            StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
                    // Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
                    .accessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                    .accessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"))
                    //.securityToken(System.getenv("ALIBABA_CLOUD_SECURITY_TOKEN")) // use STS token
                    .build());
    
            // Configure the Client
            AsyncClient client = AsyncClient.builder()
                    .region("<Your RegionId>") // Region ID
                    //.httpClient(httpClient) // Use the configured HttpClient, otherwise use the default HttpClient (Apache HttpClient)
                    .credentialsProvider(provider)
                    //.serviceConfiguration(Configuration.create()) // Service-level configuration
                    // Client-level configuration rewrite, can set Endpoint, Http request parameters, etc.
                    .overrideConfiguration(
                            ClientOverrideConfiguration.create()
                                      // For more information about endpoints, visit https://api.aliyun.com/product/live
                                    .setEndpointOverride("live.aliyuncs.com")
                            //.setConnectTimeout(Duration.ofSeconds(30))
                    )
                    .build();
    
            // Parameter settings for API request
            ForbidLiveStreamRequest forbidLiveStreamRequest = ForbidLiveStreamRequest.builder()
                    .regionId("<Your RegionId>")
                    .domainName("<Your DomainName>")
                    .appName("<Your AppName>")
                    .streamName("<Your StreamName>")
                    // Request-level configuration rewrite, can set Http request parameters, etc.
                    // .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders()))
                    .build();
    
            // Asynchronously get the API response
            CompletableFuture<ForbidLiveStreamResponse> response = client.forbidLiveStream(forbidLiveStreamRequest);
            // Synchronously get the API response
            ForbidLiveStreamResponse resp = response.get();
            System.out.println(new Gson().toJson(resp));
            // Asynchronously process the response
            /*response.thenAccept(resp -> {
                System.out.println(new Gson().toJson(resp));
            }).exceptionally(throwable -> { // Handling exceptions
                System.out.println(throwable.getMessage());
                return null;
            });*/
    
            // Close the client
            client.close();
        }
    
    }

View the stream ingest blacklist

  • View the stream ingest blacklist on the ApsaraVideo Live console

    After you disable stream ingest, go to the ApsaraVideo Live console and navigate to the Streams page. Select the domain name, click the Disabled Streams tab, and then click Search.

  • Retrieve the stream ingest blacklist using an SDK

    ApsaraVideo Live APIs are based on Alibaba Cloud OpenAPI. The provided SDKs wrap these API calls. To download the server-side SDK, see server-side SDK. For usage instructions, see SDK instructions.

    <dependency>
      <groupId>com.aliyun</groupId>
      <artifactId>alibabacloud-live20161101</artifactId>
      <version>2.0.0</version>
    </dependency>
    Note

    The SDK version number is for reference only. For the latest version, see the server-side SDK.

    The main process of the demo code is as follows:

    1. Initialize the Client object.

      The SDK uses the AsyncClient object to call OpenAPI.

    2. Initialize the Request class.

      The SDK provides a Request class and a Response class for each API. To learn which parameters are required for the Request class to disable stream ingest, see the DescribeLiveStreamsBlockList API.

    3. Send the request and get the result.

    Example code:

    // This file is auto-generated, don't edit it. Thanks.
    package demo;
    
    import com.aliyun.auth.credentials.Credential;
    import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
    import com.aliyun.core.http.HttpClient;
    import com.aliyun.core.http.HttpMethod;
    import com.aliyun.core.http.ProxyOptions;
    import com.aliyun.httpcomponent.httpclient.ApacheAsyncHttpClientBuilder;
    import com.aliyun.sdk.service.live20161101.models.*;
    import com.aliyun.sdk.service.live20161101.*;
    import com.google.gson.Gson;
    import darabonba.core.RequestConfiguration;
    import darabonba.core.client.ClientOverrideConfiguration;
    import darabonba.core.utils.CommonUtil;
    import darabonba.core.TeaPair;
    
    //import javax.net.ssl.KeyManager;
    //import javax.net.ssl.X509TrustManager;
    import java.net.InetSocketAddress;
    import java.time.Duration;
    import java.util.*;
    import java.util.concurrent.CompletableFuture;
    import java.io.*;
    
    public class DescribeLiveStreamsBlockList {
        public static void main(String[] args) throws Exception {
    
            // HttpClient Configuration
            /*HttpClient httpClient = new ApacheAsyncHttpClientBuilder()
                    .connectionTimeout(Duration.ofSeconds(10)) // Set the connection timeout. The default value is 10 seconds.
                    .responseTimeout(Duration.ofSeconds(10)) // Set the response timeout. The default value is 20 seconds.
                    .maxConnections(128) // Set the connection pool size.
                    .maxIdleTimeOut(Duration.ofSeconds(50)) // Set the connection pool idle timeout. The default value is 30 seconds.
                    // Configure the proxy.
                    .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("<YOUR-PROXY-HOSTNAME>", 9001))
                            .setCredentials("<YOUR-PROXY-USERNAME>", "<YOUR-PROXY-PASSWORD>"))
                    // For an HTTPS connection, you must configure an SSL certificate or ignore certificate verification by using .ignoreSSL(true).
                    .x509TrustManagers(new X509TrustManager[]{})
                    .keyManagers(new KeyManager[]{})
                    .ignoreSSL(false)
                    .build();*/
    
            // Configure the credentials for authentication, including the AccessKey ID, AccessKey secret, and security token.
            StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
                    // Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
                    .accessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                    .accessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"))
                    //.securityToken(System.getenv("ALIBABA_CLOUD_SECURITY_TOKEN")) // Use an STS token.
                    .build());
    
            // Configure the client.
            AsyncClient client = AsyncClient.builder()
                    .region("<Your ReginId>") // The region ID.
                    //.httpClient(httpClient) // Specify the HttpClient. If you do not specify an HttpClient, the default Apache HttpClient is used.
                    .credentialsProvider(provider)
                    //.serviceConfiguration(Configuration.create()) // Service-level configuration.
                    // Client-level override configuration. You can set parameters such as the endpoint and HTTP request parameters.
                    .overrideConfiguration(
                            ClientOverrideConfiguration.create()
                                      // For more information about the endpoint, visit https://api.aliyun.com/product/live.
                                    .setEndpointOverride("live.aliyuncs.com")
                            //.setConnectTimeout(Duration.ofSeconds(30))
                    )
                    .build();
    
            // Set the parameters for the API request.
            DescribeLiveStreamsBlockListRequest describeLiveStreamsBlockListRequest = DescribeLiveStreamsBlockListRequest.builder()
                    .domainName("<Your DomainName>")
                    // Request-level override configuration. You can set parameters such as HTTP request parameters.
                    // .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders()))
                    .build();
    
            // Asynchronously call the API operation.
            CompletableFuture<DescribeLiveStreamsBlockListResponse> response = client.describeLiveStreamsBlockList(describeLiveStreamsBlockListRequest);
            // Synchronously obtain the response.
            DescribeLiveStreamsBlockListResponse resp = response.get();
            System.out.println(new Gson().toJson(resp));
            // Asynchronously process the response.
            /*response.thenAccept(resp -> {
                System.out.println(new Gson().toJson(resp));
            }).exceptionally(throwable -> { // Handle the exception.
                System.out.println(throwable.getMessage());
                return null;
            });*/
    
            // Close the client.
            client.close();
        }
    
    }
    <dependency> <groupId>com.aliyun</groupId> <artifactId>alibabacloud-live20161101</artifactId> <version>2.0.0</version> </dependency>

Resume stream ingest

  • Resume stream ingest on the ApsaraVideo Live console

    To resume a disabled stream, go to the ApsaraVideo Live console and navigate to the Streams page. Select the domain name, click the Disabled Streams tab, and then click Enable for the desired stream.

  • Resume stream ingest using an SDK

    ApsaraVideo Live APIs are based on Alibaba Cloud OpenAPI. The provided SDKs wrap these API calls. To download the server-side SDK, see server-side SDK. For usage instructions, see SDK instructions.

    If you use the Java SDK, add the following Maven dependency to your pom.xml file:

    <dependency>
      <groupId>com.aliyun</groupId>
      <artifactId>alibabacloud-live20161101</artifactId>
      <version>2.0.0</version>
    </dependency>
    Note

    The SDK version is for reference only. For the latest version, see server-side SDK.

    The main workflow of the sample code is as follows:

    1. Initialize the Client object.

      The SDK uses an AsyncClient object to call API operations.

    2. Initialize the Request class.

      The SDK provides Request and Response classes for each API operation. For details on the request parameters, see the ResumeLiveStream API reference.

    3. Send the request and retrieve the result.

    Sample code:

    // This file is auto-generated, don't edit it. Thanks.
    package demo;
    
    import com.aliyun.auth.credentials.Credential;
    import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
    import com.aliyun.core.http.HttpClient;
    import com.aliyun.core.http.HttpMethod;
    import com.aliyun.core.http.ProxyOptions;
    import com.aliyun.httpcomponent.httpclient.ApacheAsyncHttpClientBuilder;
    import com.aliyun.sdk.service.live20161101.models.*;
    import com.aliyun.sdk.service.live20161101.*;
    import com.google.gson.Gson;
    import darabonba.core.RequestConfiguration;
    import darabonba.core.client.ClientOverrideConfiguration;
    import darabonba.core.utils.CommonUtil;
    import darabonba.core.TeaPair;
    
    //import javax.net.ssl.KeyManager;
    //import javax.net.ssl.X509TrustManager;
    import java.net.InetSocketAddress;
    import java.time.Duration;
    import java.util.*;
    import java.util.concurrent.CompletableFuture;
    import java.io.*;
    
    public class ResumeLiveStream {
        public static void main(String[] args) throws Exception {
    
            // HttpClient Configuration
            /*HttpClient httpClient = new ApacheAsyncHttpClientBuilder()
                    .connectionTimeout(Duration.ofSeconds(10)) // Set the connection timeout time, the default is 10 seconds
                    .responseTimeout(Duration.ofSeconds(10)) // Set the response timeout time, the default is 20 seconds
                    .maxConnections(128) // Set the connection pool size
                    .maxIdleTimeOut(Duration.ofSeconds(50)) // Set the connection pool timeout, the default is 30 seconds
                    // Configure the proxy
                    .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("<YOUR-PROXY-HOSTNAME>", 9001))
                            .setCredentials("<YOUR-PROXY-USERNAME>", "<YOUR-PROXY-PASSWORD>"))
                    // If it is an https connection, you need to configure the certificate, or ignore the certificate(.ignoreSSL(true))
                    .x509TrustManagers(new X509TrustManager[]{})
                    .keyManagers(new KeyManager[]{})
                    .ignoreSSL(false)
                    .build();*/
    
            // Configure Credentials authentication information, including ak, secret, token
            StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
                    // Please ensure that the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set.
                    .accessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                    .accessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"))
                    //.securityToken(System.getenv("ALIBABA_CLOUD_SECURITY_TOKEN")) // use STS token
                    .build());
    
            // Configure the Client
            AsyncClient client = AsyncClient.builder()
                    .region("<Your RegionId>") // Region ID
                    //.httpClient(httpClient) // Use the configured HttpClient, otherwise use the default HttpClient (Apache HttpClient)
                    .credentialsProvider(provider)
                    //.serviceConfiguration(Configuration.create()) // Service-level configuration
                    // Client-level configuration rewrite, can set Endpoint, Http request parameters, etc.
                    .overrideConfiguration(
                            ClientOverrideConfiguration.create()
                                      // For more information about endpoints, visit https://api.aliyun.com/product/live
                                    .setEndpointOverride("live.aliyuncs.com")
                            //.setConnectTimeout(Duration.ofSeconds(30))
                    )
                    .build();
    
            // Parameter settings for API request
            ResumeLiveStreamRequest resumeLiveStreamRequest = ResumeLiveStreamRequest.builder()
                    .domainName("<Your DomainName>")
                    .liveStreamType("<Your LiveStreamType>")
                    .appName("<Your AppName>")
                    .streamName("<Your StreamName>")
                    // Request-level configuration rewrite, can set Http request parameters, etc.
                    // .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders()))
                    .build();
    
            // Asynchronously get the API response
            CompletableFuture<ResumeLiveStreamResponse> response = client.resumeLiveStream(resumeLiveStreamRequest);
            // Synchronously get the API response
            ResumeLiveStreamResponse resp = response.get();
            System.out.println(new Gson().toJson(resp));
            // Asynchronously process the response
            /*response.thenAccept(resp -> {
                System.out.println(new Gson().toJson(resp));
            }).exceptionally(throwable -> { // Handling exceptions
                System.out.println(throwable.getMessage());
                return null;
            });*/
    
            // Close the client
            client.close();
        }
    
    }