Skip to content

Commit 2e5199f

Browse files
committed
fix: 优化几处demo
1 parent ba89ef1 commit 2e5199f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

demo/demo.js

+40
Original file line numberDiff line numberDiff line change
@@ -4593,6 +4593,46 @@ function closeOriginProtect() {
45934593
);
45944594
}
45954595

4596+
// 提交视频截帧任务
4597+
function postSnapshot() {
4598+
var host = config.Bucket + '.ci.' + config.Region + '.myqcloud.com/jobs';
4599+
var url = 'https://' + host;
4600+
var body = COS.util.json2xml({
4601+
Request: {
4602+
Tag: 'Snapshot', // 必须,固定值
4603+
Input: {
4604+
Object: 'ci/abc.mp4', // 文件名,取值为文件在当前存储桶中的完整名称
4605+
},
4606+
Operation: {
4607+
// TemplateId与Snapshot二选一传递
4608+
// TemplateId: '',
4609+
Snapshot: {
4610+
Mode: 'Interval', // 截图模式
4611+
Start: '1', // 开始时间
4612+
Count: '1', // 截图数量
4613+
},
4614+
Output: {
4615+
Bucket: config.Bucket, // 输出的存储桶
4616+
Region: config.Region, // 输出的存储桶的地域
4617+
Object: 'ci/output/snapshot-${Number}.jpg', // 输出的文件 Key
4618+
},
4619+
},
4620+
},
4621+
});
4622+
cos.request(
4623+
{
4624+
Method: 'POST',
4625+
Key: 'jobs',
4626+
Url: url,
4627+
Body: body,
4628+
ContentType: 'application/xml',
4629+
},
4630+
function (err, data) {
4631+
logger.log(err || data);
4632+
},
4633+
);
4634+
}
4635+
45964636
(function () {
45974637
var list = [
45984638
'header-工具函数',

0 commit comments

Comments
 (0)