开发指南

服务端 API 文档

有奖征文|投稿上云技术实践,赢取价值5000元大奖> HOT

1. 接口描述

接口请求域名: vod.tencentcloudapi.com 。

  • 该接口用于业务服务器以 可靠回调 的方式获取事件通知;
  • 接口为长轮询模式,即:如果服务端存在未消费事件,则立即返回给请求方;如果服务端没有未消费事件,则后台会将请求挂起,直到有新的事件产生为止;
  • 请求最多挂起5秒,建议请求方将超时时间设置为10秒;
  • 未被拉取的事件通知最多保留4天,超过该时限的事件通知可能会被清除;
  • 若该接口有事件返回,调用方必须在30秒内调用 确认事件通知 接口,确认事件通知已经处理,否则该事件通知在30秒后会再次被拉取到。
  • 当前,API 每次最多可以获取16个事件通知。

默认接口请求频率限制:100次/秒。

推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:PullEvents。
Version String 公共参数,本接口取值:2018-07-17。
Region String 公共参数,本接口不需要传递此参数。
ExtInfo String 保留字段,特殊用途时使用。
SubAppId Integer 点播子应用 ID。如果要访问子应用中的资源,则将该字段填写为子应用 ID;否则无需填写该字段。

3. 输出参数

参数名称 类型 描述
EventSet Array of EventContent 事件列表。
注意:此字段可能返回 null,表示取不到有效值。
RequestId String 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。

4. 示例

示例1 拉取事件

输入示例

POST / HTTP/1.1
Host: vod.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: PullEvents
<公共请求参数>

{}

输出示例

{
    "Response": {
        "EventSet": [
            {
                "EventHandle": "EventHandle1",
                "EventType": "ProcedureStateChanged",
                "FileUploadEvent": null,
                "ProcedureStateChangeEvent": {
                    "TaskId": "1256768367-Procedure-475b7237438a39560b9879a4556cb177t2",
                    "Status": "FINISH",
                    "ErrCode": 0,
                    "Message": "",
                    "FileId": "5285890784246869930",
                    "FileName": "small",
                    "FileUrl": "https://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/c643347c5285890784246869930/1546950643_4191274987.100_0.jpg",
                    "MetaData": {
                        "AudioDuration": 59.990001678467,
                        "AudioStreamSet": [
                            {
                                "Bitrate": 383854,
                                "Codec": "aac",
                                "SamplingRate": 48000
                            }
                        ],
                        "Bitrate": 1021028,
                        "Container": "mov,mp4,m4a,3gp,3g2,mj2",
                        "Duration": 60,
                        "Height": 480,
                        "Rotate": 0,
                        "Size": 7700180,
                        "VideoDuration": 60,
                        "VideoStreamSet": [
                            {
                                "Bitrate": 637174,
                                "Codec": "h264",
                                "Fps": 23,
                                "Height": 480,
                                "Width": 640
                            }
                        ],
                        "Width": 640
                    },
                    "MediaProcessResultSet": [
                        {
                            "Type": "Transcode",
                            "TranscodeTask": {
                                "Status": "SUCCESS",
                                "ErrCode": 0,
                                "Message": "SUCCESS",
                                "Input": {
                                    "Definition": 20,
                                    "WatermarkSet": null
                                },
                                "Output": {
                                    "Url": "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/c643347c5285890784246869930/v.f20.mp4",
                                    "Size": 4189073,
                                    "Container": "mov,mp4,m4a,3gp,3g2,mj2",
                                    "Height": 480,
                                    "Width": 640,
                                    "Bitrate": 552218,
                                    "Md5": "eff7031ad7877865f9a3240e9ab165ad",
                                    "Duration": 60.04700088501,
                                    "VideoStreamSet": [
                                        {
                                            "Bitrate": 503727,
                                            "Codec": "h264",
                                            "Fps": 24,
                                            "Height": 480,
                                            "Width": 640
                                        }
                                    ],
                                    "AudioStreamSet": [
                                        {
                                            "Bitrate": 48491,
                                            "Codec": "aac",
                                            "SamplingRate": 44100
                                        }
                                    ],
                                    "Definition": 0
                                }
                            },
                            "AnimatedGraphicTask": null,
                            "SnapshotByTimeOffsetTask": null,
                            "SampleSnapshotTask": null,
                            "ImageSpriteTask": null,
                            "CoverBySnapshotTask": null
                        },
                        {
                            "Type": "CoverBySnapshot",
                            "TranscodeTask": null,
                            "AnimatedGraphicTask": null,
                            "SnapshotByTimeOffsetTask": null,
                            "SampleSnapshotTask": null,
                            "ImageSpriteTask": null,
                            "CoverBySnapshotTask": {
                                "Status": "SUCCESS",
                                "ErrCode": 0,
                                "Message": "SUCCESS",
                                "Input": {
                                    "Definition": 10,
                                    "PositionType": "Time",
                                    "PositionValue": 0,
                                    "WatermarkSet": null
                                },
                                "Output": {
                                    "CoverUrl": "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/c643347c5285890784246869930/1546950643_4191274987.100_0.jpg"
                                }
                            }
                        }
                    ],
                    "AiContentReviewResultSet": null,
                    "AiRecognitionResultSet": null
                },
                "FileDeleteEvent": null,
                "PullCompleteEvent": null,
                "TranscodeCompleteEvent": null,
                "ConcatCompleteEvent": null,
                "ClipCompleteEvent": null,
                "CreateImageSpriteCompleteEvent": null,
                "SnapshotByTimeOffsetCompleteEvent": null
            },
            {
                "EventHandle": "EventHandle2",
                "EventType": "NewFileUpload",
                "FileUploadEvent": {
                    "FileId": "5285890784273533167",
                    "MediaBasicInfo": {
                        "Name": "small2",
                        "Description": "",
                        "CreateTime": "2019-01-09T16:36:22Z",
                        "UpdateTime": "2019-01-09T16:36:24Z",
                        "ExpireTime": "9999-12-31T23:59:59Z",
                        "ClassId": 0,
                        "ClassName": "其他",
                        "ClassPath": "其他",
                        "CoverUrl": "",
                        "Type": "mp4",
                        "MediaUrl": "http://123.vod2.myqcloud.com/1c1ae5d2vodgzp1256768367/9ce0cd925285890784273533167/q1BORBPQH1IA.mp4",
                        "TagSet": [],
                        "StorageRegion": "ap-guangzhou-2",
                        "SourceInfo": {
                            "SourceType": "Upload",
                            "SourceContext": ""
                        },
                        "Vid": "5285890784273533167"
                    },
                    "ProcedureTaskId": ""
                },
                "ProcedureStateChangeEvent": null,
                "FileDeleteEvent": null,
                "PullCompleteEvent": null,
                "TranscodeCompleteEvent": null,
                "ConcatCompleteEvent": null,
                "ClipCompleteEvent": null,
                "CreateImageSpriteCompleteEvent": null,
                "SnapshotByTimeOffsetCompleteEvent": null
            },
            {
                "EventHandle": "EventHandle3",
                "EventType": "ProcedureStateChanged",
                "FileUploadEvent": null,
                "ProcedureStateChangeEvent": {
                    "TaskId": "1256768367-procedurev2-49dfbaea6786dd78ecf70d6256c7ec20t0",
                    "Status": "FINISH",
                    "ErrCode": 0,
                    "Message": "",
                    "FileId": "5285890784273533167",
                    "FileName": "small2",
                    "FileUrl": "http://123.vod2.myqcloud.com/1c1ae5d2vodgzp1256768367/9ce0cd925285890784273533167/q1BORBPQH1IA.mp4",
                    "MetaData": {
                        "AudioDuration": 59.990001678467,
                        "AudioStreamSet": [
                            {
                                "Bitrate": 383854,
                                "Codec": "aac",
                                "SamplingRate": 48000
                            }
                        ],
                        "Bitrate": 1021028,
                        "Container": "mov,mp4,m4a,3gp,3g2,mj2",
                        "Duration": 60,
                        "Height": 480,
                        "Rotate": 0,
                        "Size": 7700180,
                        "VideoDuration": 60,
                        "VideoStreamSet": [
                            {
                                "Bitrate": 637174,
                                "Codec": "h264",
                                "Fps": 23,
                                "Height": 480,
                                "Width": 640
                            }
                        ],
                        "Width": 640
                    },
                    "MediaProcessResultSet": [
                        {
                            "Type": "SampleSnapshot",
                            "TranscodeTask": null,
                            "AnimatedGraphicTask": null,
                            "SnapshotByTimeOffsetTask": null,
                            "SampleSnapshotTask": {
                                "Status": "SUCCESS",
                                "ErrCode": 0,
                                "Message": "SUCCESS",
                                "Input": {
                                    "Definition": 10,
                                    "WatermarkSet": null
                                },
                                "Output": {
                                    "ImageUrlSet": [
                                        "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/9ce0cd925285890784273533167/1547051785_1651252995.100_0.jpg",
                                        "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/9ce0cd925285890784273533167/1547051785_1651252995.100_6000.jpg",
                                        "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/9ce0cd925285890784273533167/1547051785_1651252995.100_12000.jpg",
                                        "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/9ce0cd925285890784273533167/1547051785_1651252995.100_18000.jpg",
                                        "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/9ce0cd925285890784273533167/1547051785_1651252995.100_24000.jpg",
                                        "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/9ce0cd925285890784273533167/1547051785_1651252995.100_30000.jpg",
                                        "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/9ce0cd925285890784273533167/1547051785_1651252995.100_36000.jpg",
                                        "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/9ce0cd925285890784273533167/1547051785_1651252995.100_42000.jpg",
                                        "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/9ce0cd925285890784273533167/1547051785_1651252995.100_48000.jpg",
                                        "http://123.vod2.myqcloud.com/d042887avodtransgzp1256768367/9ce0cd925285890784273533167/1547051785_1651252995.100_54000.jpg"
                                    ],
                                    "Definition": 0,
                                    "SampleType": "",
                                    "Interval": 0,
                                    "WaterMarkDefinition": null
                                }
                            },
                            "ImageSpriteTask": null,
                            "CoverBySnapshotTask": null
                        }
                    ],
                    "AiContentReviewResultSet": null,
                    "AiRecognitionResultSet": null
                },
                "FileDeleteEvent": null,
                "PullCompleteEvent": null,
                "TranscodeCompleteEvent": null,
                "ConcatCompleteEvent": null,
                "ClipCompleteEvent": null,
                "CreateImageSpriteCompleteEvent": null,
                "SnapshotByTimeOffsetCompleteEvent": null
            },
            {
                "EventHandle": "EventHandle4",
                "EventType": "EditMediaComplete",
                "FileUploadEvent": null,
                "ProcedureStateChangeEvent": null,
                "FileDeleteEvent": null,
                "PullCompleteEvent": null,
                "EditMediaCompleteEvent": {
                    "TaskId": "1256768367-procedurev2-1b0c3f17fad2f81a5327b57f1005e115t0",
                    "Status": "FINISH",
                    "ErrCode": 0,
                    "Message": "",
                    "Input": {
                        "InputType": "ConcatFiles",
                        "FileInfoSet": [
                            {
                                "FileId": "",
                                "StartTimeOffset": 1,
                                "EndTimeOffset": 5
                            }
                        ],
                        "StreamInfoSet": null
                    },
                    "Output": {
                        "FileType": "",
                        "FileId": "15517827183909093239",
                        "FileUrl": "http://1256768367.vod2.myqcloud.com/1c1ae5d2vodgzp1256768367/e0a739c115517827183909093239/clip.mp4"
                    },
                    "ProcedureTaskId": ""
                },
                "TranscodeCompleteEvent": null,
                "ConcatCompleteEvent": null,
                "ClipCompleteEvent": null,
                "CreateImageSpriteCompleteEvent": null,
                "SnapshotByTimeOffsetCompleteEvent": null,
                "ReviewAudioVideoCompleteEvent": null
            }
        ],
        "RequestId": "335bdaa3-db0e-46ce-9946-51941d9cb0f5"
    }
}

5. 开发者资源

腾讯云 API 平台

腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。

API Inspector

用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。

SDK

云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。

命令行工具

6. 错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码

错误码 描述
FailedOperation 操作失败。
FailedOperation.InvalidVodUser 没有开通点播业务。
InternalError 内部错误。
InvalidParameterValue 参数取值错误。
ResourceNotFound 资源不存在。
UnauthorizedOperation 未授权操作。
目录