This document provides an overview of APIs and SDK code samples for screenshot job submission.
API | Description |
---|---|
Submitting screenshot job | Submits screenshot job |
This API is used to submit a screenshot job.
public Guzzle\Service\Resource\Model createMediaSnapshotJobs(array $args = array());
<?php
require dirname(__FILE__) . '/../vendor/autoload.php';
$secretId = "SECRETID"; // Replace it with your real `secretId`, which can be viewed and managed in the CAM console at https://console.intl.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; // Replace it with your real `secretKey`, which can be viewed and managed in the CAM console at https://console.intl.cloud.tencent.com/cam/capi
$region = "ap-beijing"; // Replace it with your real region information, which can be viewed in the console at https://console.intl.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // Protocol header, which is `http` by default
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createMediaSnapshotJobs(array(
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.intl.cloud.tencent.com/cos5/bucket
'Tag' => 'Snapshot',
'QueueId' => 'asdadadfafsdkjhfjghdfjg',
'CallBack' => 'https://example.com/callback',
'Input' => array(
'Object' => 'video01.mp4'
),
'Operation' => array(
'TemplateId' => 'asdfafiahfiushdfisdhfuis',
'Output' => array(
'Region' => $region,
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.intl.cloud.tencent.com/cos5/bucket
'Object' => 'snapshot-${Number}.jpg',
),
),
));
// Request successful
print_r($result);
} catch (\Exception $e) {
// Request failed
echo($e);
}
<?php
require dirname(__FILE__) . '/../vendor/autoload.php';
$secretId = "SECRETID"; // Replace it with your real `secretId`, which can be viewed and managed in the CAM console at https://console.intl.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; // Replace it with your real `secretKey`, which can be viewed and managed in the CAM console at https://console.intl.cloud.tencent.com/cam/capi
$region = "ap-beijing"; // Replace it with your real region information, which can be viewed in the console at https://console.intl.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // Protocol header, which is `http` by default
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createMediaSnapshotJobs(array(
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.intl.cloud.tencent.com/cos5/bucket
'Tag' => 'Snapshot',
'QueueId' => 'asdadadfafsdkjhfjghdfjg',
'CallBack' => 'https://example.com/callback',
'Input' => array(
'Object' => 'video01.mp4'
),
'Operation' => array(
'Output' => array(
'Region' => $region,
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.intl.cloud.tencent.com/cos5/bucket
'Object' => 'snapshot-${Number}.jpg',
),
'Snapshot' => array(
'Mode' => 'Average',
'Start' => 3,
'TimeInterval' => '',
'Count' => 3,
'Width' => '1280',
'Height' => '',
),
),
));
// Request successful
print_r($result);
} catch (\Exception $e) {
// Request failed
echo($e);
}
Request
has the following sub-nodes:
Node Name (Keyword) | Parent Node | Description | Type | Required |
---|---|---|---|---|
Tag | Request | Job type. Valid values: Transcode (transcoding), Animation (animated image), SmartCover (intelligent thumbnail), Snapshot (screenshot), Concat (splicing) | String | Yes |
Input | Request | Information of the media file to be processed | Container | Yes |
Operation | Request | Operation rule. Up to six operation rules are supported. | Container | Yes |
QueueId | Request | Queue ID of the job | String | Yes |
CallBack | Request | Callback address | String | No |
Input
has the following sub-nodes:
Node Name (Keyword) | Parent Node | Description | Type | Required |
---|---|---|---|---|
Object | Request.Input | Media filename | String | Yes |
Operation
has the following sub-nodes:
Node Name (Keyword) | Parent Node | Description | Type | Required |
---|---|---|---|---|
Snapshot | Request.Operation | Job type parameter. Same as Request.Snapshot in the screenshot template creation API CreateMediaTemplate . |
Container | No |
TemplateId | Request.Operation | Template ID | String | No |
Output | Request.Operation | Result output address | Container | Yes |
Note:
TemplateId
is used with priority. IfTemplateId
is unavailable, the corresponding job type parameter is used.
Output
has the following sub-nodes:
Node Name (Keyword) | Parent Node | Description | Type | Required |
---|---|---|---|---|
Region | Request.Operation.Output | Bucket region | String | Yes |
Bucket | Request.Operation.Output | Result storage bucket | String | Yes |
Object | Request.Operation.Output | Result filename. If the job type is Snapshot , ${Number} must be included in the filename. For example, you can set Object to snapshot-${Number}.jpg . |
String | No |
SpriteObject | Request.Operation.Output | Image sprite name. If the job type is Snapshot , ${Number} must be included in the filename. For example, you can set Object to snapshot-${Number}.jpg . Only the .jpg format is supported. |
String | No |
GuzzleHttp\Command\Result Object
(
[Body] => GuzzleHttp\Psr7\Stream Object
(
[stream:GuzzleHttp\Psr7\Stream:private] => Resource id #88
[size:GuzzleHttp\Psr7\Stream:private] =>
[seekable:GuzzleHttp\Psr7\Stream:private] => 1
[readable:GuzzleHttp\Psr7\Stream:private] => 1
[writable:GuzzleHttp\Psr7\Stream:private] => 1
[uri:GuzzleHttp\Psr7\Stream:private] => php://temp
[customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
(
)
)
[RequestId] => NjI2MTNkYAHDUIAHDRfNjQ0OF8yMGI4MjQ=
[ContentType] => application/xml
[ContentLength] => 829
[Bucket] => examplebucket-1250000000
[Location] => examplebucket-1250000000.ci.ap-beijing.myqcloud.com/jobs
[Response] => Array
(
[JobsDetail] => Array
(
[Code] => Success
[CreationTime] => 2022-04-21T19:19:25+0800
[EndTime] => -
[Input] => Array
(
[BucketId] => examplebucket-1250000000
[Object] => video01.mp4
[Region] => ap-beijing
)
[JobId] => je6dcd3d6a80d98a09ds8ac4214b9b
[Message] =>
[Operation] => Array
(
[Output] => Array
(
[Bucket] => examplebucket-1250000000
[Object] => snapshot-${Number}.jpg
[Region] => ap-beijing
[SpriteObject] =>
)
[TemplateId] => t0778zc908zc908z0c8z0adcffd54a
[TemplateName] => snapshot_1280*720_3
)
[QueueId] => p81e648afz7zc08c0z8xc09e086
[StartTime] => -
[State] => Submitted
[Tag] => Snapshot
)
)
)
Was this page helpful?