任务流状态变更

最后更新时间:2021-02-20 16:29:35

    注意:

    • 本文档为3.0版本的格式回调。
    • 建议您将回调版本逐步迁移到3.0格式,2.0格式回调的文档将不再维护。

    事件名称

    ProcedureStateChanged

    事件说明

    当 App 配置了事件通知后,在任务流的状态发生变更后,App 后台即可通过“普通回调”或“可靠回调”的方式获取该事件通知。事件通知内容为 ProcedureTask 结构

    示例

    普通回调

    如果选择普通回调模式,则回调 URL 会接收到来自云点播的 HTTP 请求。请求采用 POST 方法,请求内容在 BODY 中,如下所示(省略了值为 null 的字段)。

    {
        "EventType":"ProcedureStateChanged",
        "ProcedureStateChangeEvent":{
            "TaskId":"1256768367-Procedure-475b72xxxcb177t1",
            "Status":"FINISH",
            "ErrCode":0,
            "Message":"",
            "FileId":"5285890784246869930",
            "FileName":"动物世界",
            "FileUrl":"https://1256768367.vod2.myqcloud.com/xxx/xxx/xxx.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":"Transcode",
                    "TranscodeTask":{
                        "Status":"SUCCESS",
                        "ErrCode":0,
                        "Message":"SUCCESS",
                        "Input":{
                            "Definition":20
                        },
                        "Output":{
                            "Url":"https://1256768367.vod2.myqcloud.com/xxx/xxx/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
                        }
                    }
                },
                {
                    "Type":"CoverBySnapshot",
                    "CoverBySnapshotTask":{
                        "Status":"SUCCESS",
                        "ErrCode":0,
                        "Message":"SUCCESS",
                        "Input":{
                            "Definition":10,
                            "PositionType":"Time",
                            "PositionValue":0
                        },
                        "Output":{
                            "CoverUrl":"http://1256768367.vod2.myqcloud.com/xxx/xxx/xxx.100_0.jpg"
                        }
                    }
                }
            ]
        }
    }

    可靠回调

    如果选择可靠回调模式,调用 拉取事件通知 API 会接收到如下形式的 HTTP 应答(省略了值为 null 的字段)。

    {
        "Response": {
            "EventSet": [
                {
                    "EventHandle": "EventHandleX",
                    "EventType": "ProcedureStateChanged",
                    "ProcedureStateChangeEvent": {
                        "TaskId": "1256768367-Procedure-475b72xxxcb177t1",
                        "Status": "FINISH",
                        "FileId": "5285890784246869930",
                        "FileName": "动物世界",
                        "FileUrl": "https://1256768367.vod2.myqcloud.com/xxx/xxx/xxx.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": "Transcode",
                                "TranscodeTask": {
                                    "Status": "SUCCESS",
                                    "ErrCode": 0,
                                    "Message": "SUCCESS",
                                    "Input": {
                                        "Definition": 20
                                    },
                                    "Output": {
                                        "Url": "https://1256768367.vod2.myqcloud.com/xxx/xxx/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
                                    }
                                }
                            },
                            {
                                "Type": "CoverBySnapshot",
                                "CoverBySnapshotTask": {
                                    "Status": "SUCCESS",
                                    "ErrCode": 0,
                                    "Message": "SUCCESS",
                                    "Input": {
                                        "Definition": 10,
                                        "PositionType": "Time",
                                        "PositionValue": 0
                                    },
                                    "Output": {
                                        "CoverUrl": "http://1256768367.vod2.myqcloud.com/xxx/xxx/xxx.100_0.jpg"
                                    }
                                }
                            }
                        ]
                    }
                }
            ],
            "RequestId": "335bdaa3-db0e-46ce-9946-51941d9cb0f5"
        }
    }