アップストリーミングをブロックするタイミング
セキュリティ要件を満たすために、ApsaraVideo Live でアップストリーミングをブロックできます。これは、認証済みアップストリーミング URL が漏洩した場合、悪意のあるアップストリーミングが検出された場合、またはビジネス要件により特定の URL へのアップストリーミングが禁止されている場合に役立ちます。
アップストリーミングのブロック
-
ApsaraVideo Live コンソールでのアップストリーミングのブロック
-
アクティブなアップストリーミング URL の検索とブロック
ストリームがアクティブになったら、ApsaraVideo Live コンソールの ページに移動します。 目的のドメイン名を選択し、検索 をクリックしてアクティブなライブストリームを見つけ、次に ブロック をクリックします。
[操作] 列で、その他アイコン (⋮) をクリックしてメニューを開き、[ストリームの中断] と [ライブクリッピング] を選択できます。
-
履歴アップストリーミング URL の検索とブロック
ストリームが終了したら、ApsaraVideo Live コンソールに移動して ページを開きます。ログ タブをクリックし、ドメイン名を選択して 検索 をクリックします。目的のストリームを見つけ、ブロック をクリックします。
-
-
SDK を使用したアップストリーミングのブロック
ApsaraVideo Live API は Alibaba Cloud OpenAPI に基づいています。提供される SDK はこれらの API 呼び出しをラップします。サーバーサイド SDK をダウンロードするには、「サーバーサイド SDK」をご参照ください。使用方法については、「SDK の使用方法」をご参照ください。
Java SDK を使用する場合は、pom.xml ファイルに以下の Maven 依存関係を追加します:
<dependency> <groupId>com.aliyun</groupId> <artifactId>alibabacloud-live20161101</artifactId> <version>2.0.0</version> </dependency>説明SDK のバージョンは参考用です。最新バージョンについては、「サーバーサイド SDK」をご参照ください。
サンプルコードの主なワークフローは次のとおりです:
-
Client オブジェクトを初期化します。
SDK は AsyncClient オブジェクトを使用して API を呼び出します。
-
Request クラスを初期化します。
SDK は各 API に対して Request クラスと Response クラスを提供します。リクエストパラメーターの詳細については、「ForbidLiveStream API」をご参照ください。
-
リクエストを送信して結果を取得します。
サンプルコード:
// このファイルは自動生成されています。編集しないでください。 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 の設定 /*HttpClient httpClient = new ApacheAsyncHttpClientBuilder() .connectionTimeout(Duration.ofSeconds(10)) // 接続タイムアウトを設定します。デフォルトは 10 秒です。 .responseTimeout(Duration.ofSeconds(10)) // レスポンスタイムアウトを設定します。デフォルトは 20 秒です。 .maxConnections(128) // 接続プールサイズを設定します。 .maxIdleTimeOut(Duration.ofSeconds(50)) // 接続プールのタイムアウトを設定します。デフォルトは 30 秒です。 // プロキシを設定します。 .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("", 9001)) .setCredentials(" ", " ")) // HTTPS 接続の場合は、証明書を設定するか、証明書の検証を無視する (.ignoreSSL(true)) 必要があります。 .x509TrustManagers(new X509TrustManager[]{}) .keyManagers(new KeyManager[]{}) .ignoreSSL(false) .build();*/ // 認証情報 (AccessKey ID、AccessKey Secret、セキュリティトークン) を設定します。 StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder() // 環境変数 ALIBABA_CLOUD_ACCESS_KEY_ID と ALIBABA_CLOUD_ACCESS_KEY_SECRET が設定されていることを確認してください。 .accessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID")) .accessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET")) //.securityToken(System.getenv("ALIBABA_CLOUD_SECURITY_TOKEN")) // STS トークンを使用します。 .build()); // クライアントを設定します。 AsyncClient client = AsyncClient.builder() .region(" ") // リージョン ID //.httpClient(httpClient) // 設定された HttpClient を使用します。指定しない場合は、デフォルトの HttpClient (Apache HttpClient) が使用されます。 .credentialsProvider(provider) //.serviceConfiguration(Configuration.create()) // サービスレベルの設定 // クライアントレベルでの設定の上書き。エンドポイントや HTTP リクエストパラメーターなどを設定できます。 .overrideConfiguration( ClientOverrideConfiguration.create() // エンドポイントの詳細については、https://api.aliyun.com/product/live をご参照ください。 .setEndpointOverride("live.aliyuncs.com") //.setConnectTimeout(Duration.ofSeconds(30)) ) .build(); // API リクエストのパラメーターを設定します。 ForbidLiveStreamRequest forbidLiveStreamRequest = ForbidLiveStreamRequest.builder() .regionId(" ") .domainName(" ") .appName(" ") .streamName(" ") // リクエストレベルでの設定の上書き。HTTP リクエストパラメーターなどを設定できます。 // .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders())) .build(); // API レスポンスを非同期で取得します。 CompletableFuture response = client.forbidLiveStream(forbidLiveStreamRequest); // API レスポンスを同期的に取得します。 ForbidLiveStreamResponse resp = response.get(); System.out.println(new Gson().toJson(resp)); // レスポンスを非同期で処理します。 /*response.thenAccept(resp -> { System.out.println(new Gson().toJson(resp)); }).exceptionally(throwable -> { // 例外を処理します。 System.out.println(throwable.getMessage()); return null; });*/ // クライアントを閉じます。 client.close(); } } -
アップストリーミングブラックリストの表示
-
ApsaraVideo Live コンソールでのアップストリーミングブラックリストの表示
ストリーム取り込みを無効にした後、ApsaraVideo Live コンソールに移動して ページを開きます。 ドメイン名を選択し、ブロック済み タブをクリックし、次に 検索 をクリックします。
-
SDK を使用したアップストリーミングブラックリストの取得
ApsaraVideo Live API は Alibaba Cloud OpenAPI に基づいています。提供される SDK はこれらの API 呼び出しをラップします。サーバーサイド SDK をダウンロードするには、「サーバーサイド SDK」をご参照ください。使用方法については、「SDK の使用方法」をご参照ください。
<dependency> <groupId>com.aliyun</groupId> <artifactId>alibabacloud-live20161101</artifactId> <version>2.0.0</version> </dependency>説明SDK のバージョン番号は参考用です。最新バージョンについては、サーバーサイド SDK をご参照ください。
サンプルコードの主なワークフローは次のとおりです:
-
Client オブジェクトを初期化します。
SDK は AsyncClient オブジェクトを使用して OpenAPI を呼び出します。
-
Request クラスを初期化します。
SDK は各 API に対して Request クラスと Response クラスを提供します。アップストリーミングブラックリストを取得するために Request クラスに必要なパラメーターについては、「DescribeLiveStreamsBlockList API」をご参照ください。
-
リクエストを送信して結果を取得します。
サンプルコード:
// このファイルは自動生成されています。編集しないでください。 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 の設定 /*HttpClient httpClient = new ApacheAsyncHttpClientBuilder() .connectionTimeout(Duration.ofSeconds(10)) // 接続タイムアウトを設定します。デフォルトは 10 秒です。 .responseTimeout(Duration.ofSeconds(10)) // レスポンスタイムアウトを設定します。デフォルトは 20 秒です。 .maxConnections(128) // 接続プールサイズを設定します。 .maxIdleTimeOut(Duration.ofSeconds(50)) // 接続プールのアイドルタイムアウトを設定します。デフォルトは 30 秒です。 // プロキシを設定します。 .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("", 9001)) .setCredentials(" ", " ")) // HTTPS 接続の場合は、SSL 証明書を設定するか、.ignoreSSL(true) を使用して証明書の検証を無視する必要があります。 .x509TrustManagers(new X509TrustManager[]{}) .keyManagers(new KeyManager[]{}) .ignoreSSL(false) .build();*/ // 認証情報 (AccessKey ID、AccessKey Secret、セキュリティトークン) を設定します。 StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder() // 環境変数 ALIBABA_CLOUD_ACCESS_KEY_ID と ALIBABA_CLOUD_ACCESS_KEY_SECRET が設定されていることを確認してください。 .accessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID")) .accessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET")) //.securityToken(System.getenv("ALIBABA_CLOUD_SECURITY_TOKEN")) // STS トークンを使用します。 .build()); // クライアントを設定します。 AsyncClient client = AsyncClient.builder() .region(" ") // リージョン ID //.httpClient(httpClient) // HttpClient を指定します。HttpClient を指定しない場合は、デフォルトの Apache HttpClient が使用されます。 .credentialsProvider(provider) //.serviceConfiguration(Configuration.create()) // サービスレベルの設定 // クライアントレベルでの設定の上書き。エンドポイントや HTTP リクエストパラメーターなどのパラメーターを設定できます。 .overrideConfiguration( ClientOverrideConfiguration.create() // エンドポイントの詳細については、https://api.aliyun.com/product/live をご参照ください。 .setEndpointOverride("live.aliyuncs.com") //.setConnectTimeout(Duration.ofSeconds(30)) ) .build(); // API リクエストのパラメーターを設定します。 DescribeLiveStreamsBlockListRequest describeLiveStreamsBlockListRequest = DescribeLiveStreamsBlockListRequest.builder() .domainName(" ") // リクエストレベルでの設定の上書き。HTTP リクエストパラメーターなどのパラメーターを設定できます。 // .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders())) .build(); // API を非同期で呼び出します。 CompletableFuture response = client.describeLiveStreamsBlockList(describeLiveStreamsBlockListRequest); // レスポンスを同期的に取得します。 DescribeLiveStreamsBlockListResponse resp = response.get(); System.out.println(new Gson().toJson(resp)); // レスポンスを非同期で処理します。 /*response.thenAccept(resp -> { System.out.println(new Gson().toJson(resp)); }).exceptionally(throwable -> { // 例外を処理します。 System.out.println(throwable.getMessage()); return null; });*/ // クライアントを閉じます。 client.close(); } } -
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 page. Select the domain name, click the [ブロック済み] tab, and then click [再開] for the desired stream.
-
Resume stream ingest using an SDK
ApsaraVideo Live API は Alibaba Cloud OpenAPI に基づいています。提供される SDK はこれらの API 呼び出しをラップします。サーバーサイド SDK をダウンロードするには、「サーバーサイド SDK」をご参照ください。使用方法については、「SDK の使用方法」をご参照ください。
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>説明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:
-
Initialize the Client object.
The SDK uses an AsyncClient object to call API operations.
-
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.
-
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(); } } -