拉取事件通知

最近更新时间:2019-08-01 19:09:37

1. 接口描述

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

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

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

2. 输入参数

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

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

3. 输出参数

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

4. 示例

示例1 拉取事件

输入示例

https://vod.tencentcloudapi.com/?Action=PullEvents
&<公共请求参数>

输出示例

{
  "Response": {
    "EventSet": [
      {
        "EventHandle": "EventHandle1",
        "EventType": "ProcedureStateChanged",
        "FileUploadEvent": null,
        "ProcedureStateChangeEvent": {
          "TaskId": "1256768367-Procedure-475b7237438a39560b9879a4556cb177t1",
          "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,
        "EditMediaComplete": null,
        "WechatPublishComplete": 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,
        "EditMediaComplete": null,
        "WechatPublishComplete": 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,
        "EditMediaComplete": null,
        "WechatPublishComplete": 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": ""
        },
        "WechatPublishComplete": null,
        "TranscodeCompleteEvent": null,
        "ConcatCompleteEvent": null,
        "ClipCompleteEvent": null,
        "CreateImageSpriteCompleteEvent": null,
        "SnapshotByTimeOffsetCompleteEvent": null
      }
    ],
    "RequestId": "335bdaa3-db0e-46ce-9946-51941d9cb0f5"
  }
}

5. 开发者资源

API Explorer

该工具提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力,能显著降低使用云 API 的难度,推荐使用。

SDK

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

命令行工具

6. 错误码

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

错误码 描述
FailedOperation 操作失败。
InternalError 内部错误。
InvalidParameterValue 参数取值错误。
ResourceNotFound 资源不存在。
UnauthorizedOperation 未授权操作。