// Replace the placeholders with actual values.
DefaultProfile profile = DefaultProfile.getProfile("<regionId>", "<ALIBABA_CLOUD_ACCESS_KEY_ID>", "<ALIBABA_CLOUD_ACCESS_KEY_SECRET>");
IAcsClient client = new DefaultAcsClient(profile);
AddLiveAppSnapshotConfigRequest addLiveAppSnapshotConfigRequest = new AddLiveAppSnapshotConfigRequest();
addLiveAppSnapshotConfigRequest.setDomainName("<DomainName>");
addLiveAppSnapshotConfigRequest.setAppName("<AppName>");
// The interval at which snapshots are captured. Valid values: 5 to 3600.
addLiveAppSnapshotConfigRequest.setTimeInterval(5);
addLiveAppSnapshotConfigRequest.setOssEndpoint("<Endpoint>");
addLiveAppSnapshotConfigRequest.setOssBucket("<BucketName>");
// The name of the OSS object to be generated when a snapshot is captured in overwrite mode. The name must be less than 256 bytes in length. The name can contain variables, such as {AppName} and {StreamName}.
addLiveAppSnapshotConfigRequest.setOverwriteOssObject("<{AppName}/{StreamName}.jpg>");
// The name of the OSS object to be generated when a snapshot is captured in real-time mode. The name must be less than 256 bytes in length. The name can contain variables, such as {AppName}, {StreamName}, {UnixTimestamp}, and {Sequence}. You must specify one of {UnixTimestamp} and {Sequence}.
addLiveAppSnapshotConfigRequest.setSequenceOssObject("<{AppName}/{StreamName}/{UnixTimestamp}.jpg>");
try {
AddLiveAppSnapshotConfigResponse addLiveAppSnapshotConfigResponse = client.getAcsResponse(addLiveAppSnapshotConfigRequest);
System.out.println(addLiveAppSnapshotConfigResponse.getRequestId());
// todo something.
} catch (ServerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Replace the placeholders with actual values.
DefaultProfile profile = DefaultProfile.getProfile("<regionId>", "<ALIBABA_CLOUD_ACCESS_KEY_ID>", "<ALIBABA_CLOUD_ACCESS_KEY_SECRET>");
IAcsClient client = new DefaultAcsClient(profile);
DescribeLiveStreamSnapshotInfoRequest describeLiveStreamSnapshotInfoRequest=new DescribeLiveStreamSnapshotInfoRequest();
describeLiveStreamSnapshotInfoRequest.setAppName("<AppName>");
describeLiveStreamSnapshotInfoRequest.setStreamName("<StreamName>");
describeLiveStreamSnapshotInfoRequest.setDomainName("<DomainName>");
// The beginning of the time range to query. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC.
describeLiveStreamSnapshotInfoRequest.setStartTime("<StartTime>");
// The end of the time range to query. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format and is displayed in UTC. The duration specified by the StartTime and EndTime parameters cannot exceed one day.
describeLiveStreamSnapshotInfoRequest.setEndTime("<EndTime>");
DescribeLiveStreamSnapshotInfoResponse describeLiveStreamSnapshotInfoResponse = null;
try {
describeLiveStreamSnapshotInfoResponse = client.getAcsResponse(describeLiveStreamSnapshotInfoRequest);
} catch (ClientException e) {
e.printStackTrace();
}
System.out.println(new Gson().toJson(describeLiveStreamSnapshotInfoResponse));