视频直播:直播截图

视频直播:直播截图

截图文件管理查看截图文件您可以通过三种方式查看截图文件。

控制台查看截图文件

登录视频直播控制台。在左侧导航栏选择功能管理>直播截图,进入直播截图页面,选择截图管理。

选择待查询的域名及时间,然后输入或选择AppName和StreamName。

单击查询,查看选择时间段内的截图。若截图无法查看,请确定OSS Bucket读写权限是否为公共读,具体操作,请参见配置OSS bucket读写权限。

将鼠标移动到某一图片上方,可以查看大图或复制截图的流地址。

API查看截图文件

Java// 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 DescribeLiveStreamSnapshotInfo {

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("", 9001))

.setCredentials("", ""))

// 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("") // 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()

// Endpoint 请参考 https://api.aliyun.com/product/live

.setEndpointOverride("live.aliyuncs.com")

//.setConnectTimeout(Duration.ofSeconds(30))

)

.build();

// Parameter settings for API request

DescribeLiveStreamSnapshotInfoRequest describeLiveStreamSnapshotInfoRequest = DescribeLiveStreamSnapshotInfoRequest.builder()

.domainName("")

.appName("")

.streamName("")

.startTime("")

.endTime("")

// Request-level configuration rewrite, can set Http request parameters, etc.

// .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders()))

.build();

// Asynchronously get the return value of the API request

CompletableFuture response = client.describeLiveStreamSnapshotInfo(describeLiveStreamSnapshotInfoRequest);

// Synchronously get the return value of the API request

DescribeLiveStreamSnapshotInfoResponse resp = response.get();

System.out.println(new Gson().toJson(resp));

// Asynchronous processing of return values

/*response.thenAccept(resp -> {

System.out.println(new Gson().toJson(resp));

}).exceptionally(throwable -> { // Handling exceptions

System.out.println(throwable.getMessage());

return null;

});*/

// Finally, close the client

client.close();

}

}重要 目前只支持查询一年内其中某一天(EndTime和StartTime之间的间隔不能超过1天)的截图文件。

截图类型配置为覆盖截图+实时截图的情况下,只能查询出实时截图的文件内容。若在此情况下要查看覆盖截图的截图文件,请在OSS中查看,详情可参见OSS列举文件。

接口暂不支持分页,且一次最多返回100条数据(默认返回10条数据)。

更多查询截图文件内容接口说明,请参见DescribeLiveStreamSnapshotInfo。

OSS查看截图文件

在配置截图功能时,您已指定了截图文件在OSS中的存储地址。如果需要在OSS中查看截图文件,可参见OSS列举文件。

删除截图文件

视频直播储存的是截图文件信息,如AppName,StreamName,OSS文件储存路径等,文件是储存在OSS中。如果在删除截图时需要同步删除储存在OSS中的文件,则需要创建服务角色AliyunMTSVideoLifecycleRole,并精确授权AliyunMTSVideoLifecycleRolePolicy系统策略。

详细授权过程

在直播控制台删除截图或录制文件时需要先进行授权,您需要按照如下步骤在RAM控制台创建并授权RAM角色后,再登录直播控制台删除截图或录制文件。

创建普通服务角色使用RAM管理员登录RAM控制台。

在左侧导航栏,选择身份管理 > 角色。

在角色页面,单击创建角色。

在创建角色页面,选择信任主体类型为云服务,然后选择具体的阿里云服务,最后单击确定。

说明 信任主体名称下拉框中请选择“媒体处理”。

在弹出的创建角色对话框,角色名称栏中输入“AliyunMTSVideoLifecycleRole”作为角色名称,然后单击确定。

角色创建成功后,在角色基本信息页面下选择权限管理页签。

点击精确授权,请按照以下参数配置:

选择权限类型:系统策略

输入策略名称:AliyunMTSVideoLifecycleRolePolicy

配置完成后,单击确定。

您可以通过三种方式删除截图文件:

控制台删除截图文件

登录视频直播控制台。在左侧导航栏选择功能管理>直播截图,进入直播截图页面,选择截图管理。

选择待查询的域名及时间,然后输入或选择AppName和StreamName。

将鼠标移动到某一图片上方,单击删除按钮可进行单张删除。

勾选多张截图后单击批量删除,可批量删除截图。最多可支持批量删除200张截图。

API删除截图文件

Java// 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 DeleteSnapshotFiles {

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("", 9001))

.setCredentials("", ""))

// 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("") // 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()

// Endpoint 请参考 https://api.aliyun.com/product/live

.setEndpointOverride("live.aliyuncs.com")

//.setConnectTimeout(Duration.ofSeconds(30))

)

.build();

// Parameter settings for API request

DeleteSnapshotFilesRequest deleteSnapshotFilesRequest = DeleteSnapshotFilesRequest.builder()

.regionId("")

.domainName("")

.appName("")

.streamName("")

.removeFile(true)

// Request-level configuration rewrite, can set Http request parameters, etc.

// .requestConfiguration(RequestConfiguration.create().setHttpHeaders(new HttpHeaders()))

.build();

// Asynchronously get the return value of the API request

CompletableFuture response = client.deleteSnapshotFiles(deleteSnapshotFilesRequest);

// Synchronously get the return value of the API request

DeleteSnapshotFilesResponse resp = response.get();

System.out.println(new Gson().toJson(resp));

// Asynchronous processing of return values

/*response.thenAccept(resp -> {

System.out.println(new Gson().toJson(resp));

}).exceptionally(throwable -> { // Handling exceptions

System.out.println(throwable.getMessage());

return null;

});*/

// Finally, close the client

client.close();

}

}重要 目前只支持删除一年内的截图文件。

截图文件时间戳可通过查询截图文件获取。详情可参见查看截图文件。

对于覆盖截图的截图文件,目前只能在OSS中进行删除,具体操作可参见OSS删除文件。

更多删除直播截图文件接口说明,请参见DeleteSnapshotFiles。

以上示例实现了对截图文件的删除(同时删除了储存在OSS中的文件)。

您可以为截图功能设置回调事件,获取回调参数将截图信息保存至您自己的业务系统(同时储存时间戳),在需要删除文件时,您就可以根据您系统的策略(如通过定时任务每天定时删除N个月以前的截图文件)查询出截图文件时间戳对截图文件进行删除。若想了解截图回调,可参见直播截图回调开发指南。

OSS删除截图文件

一般情况下,不建议您直接删除存储在OSS中的截图文件。如果需要删除存储在OSS中的截图文件,可以通过视频直播删除截图文件时同步删除存储在OSS中的文件。如果您因为业务需求需要直接删除存储在OSS中的截图文件,可参考文档OSS删除文件。

// 相关文章

手机体重管理软件排行榜TOP10推荐
亚洲365bet网站

手机体重管理软件排行榜TOP10推荐

⌛ 07-03 ⚠️ 5880
秋瓷炫从韩国回北京,给500平豪宅大扫除,网友感叹这家也太大了
共享单车哪个不用押金(共享单车每次都要交押金吗)