Ubuntu Server 16.04.1 LTS 64位或Ubuntu Server 18.04.1 LTS 64位。
ubuntu@VM-69-2-ubuntu:~$ export SECRET_ID=AKxxxxxxxxxxxxxxxxxxxxxxx; export SECRET_KEY=xxxxxxxxxxxxxxxxxxxxx;export APPID=125xxxxxxx;git clone https://github.com/tencentyun/vod-server-demo.git ~/vod-server-demo; bash ~/vod-server-demo/installer/callback_scf.sh
[2020-06-05 17:16:08]开始安装 pip3。[2020-06-05 17:16:12]pip3 安装成功。[2020-06-05 17:16:12]开始安装腾讯云 SCF 工具。[2020-06-05 17:16:13]scf 安装成功。[2020-06-05 17:16:13]开始配置 scf。[2020-06-05 17:16:14]scf 配置完成。[2020-06-05 17:16:14]开始部署云点播事件通知接收服务。[2020-06-05 17:16:24]云点播事件通知接收服务部署完成。[2020-06-05 17:16:26]服务地址:https://service-xxxxxxxx-125xxxxxxx.gz.apigw.tencentcs.com/release/callback
https://service-xxxxxxxx-125xxxxxxx.gz.apigw.tencentcs.com/release/callback)。[2020-04-25 17:18:44]警告:事件通知接收服务测试不通过。



main_handler()为入口函数。parse_conf_file(),从config.json文件中读取配置信息。配置项说明如下:字段 | 数据类型 | 功能 |
secret_id | String | API 密钥 |
secret_key | String | API 密钥 |
region | String | 云 API 请求地域,对于 VOD 可随意填写 |
definitions | Array of Integer | 转码模板 |
subappid | Integer | 事件通知是否来自 云点播子应用 |
deal_new_file_event()解析请求,从中取出新上传视频的 FileId:if event_type == "NewFileUpload":fileid = deal_new_file_event(body)if fileid is None:return ERR_RETURN
trans_media()发起转码,输出云 API 的回包到 SCF 日志,并回包给 VOD 的事件通知服务:rsp = trans_media(configuration, fileid)if rsp is None:return ERR_RETURNprint(rsp)
trans_media()中,调用云 API SDK 发起 ProcessMedia 请求:cred = credential.Credential(conf["secret_id"], conf["secret_key"])client = vod_client.VodClient(cred, conf["region"])method = getattr(models, API_NAME + "Request")req = method()req.from_json_string(json.dumps(params))method = getattr(client, API_NAME)rsp = method(req)return rsp
deal_procedure_event()解析请求,从中取出转码输出视频的 URL 并打印到 SCF 日志:elif event_type == "ProcedureStateChanged":rsp = deal_procedure_event(body)if rsp is None:return ERR_RETURN
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback