Stream Live 提供 webhooks,在 Input 连接、断开或与 Stream Live 遇到错误时通知您的服务。
Stream Live Notifications
适用对象使用 Stream、并希望接收包含其视频状态的 webhook 的客户。
其他选项/筛选条件您可以输入 Stream Live ID,仅接收有关这些输入的通知。如果留空,您将收到所有输入的列表。
以下输入状态将触发通知,您可以分别开启或关闭:
live_input.connectedlive_input.disconnected
Stream 订阅。
收到通知后应如何处理?Stream 通知完全可由客户自定义。所需操作取决于已启用的自定义设置。
-
在 Cloudflare 仪表板中,前往 Notifications(通知) 页面。
前往 Notifications(通知) ↗ -
选择 Destinations(目标) 选项卡。
-
在 Destinations(目标) 页面的 Webhooks(Webhook) 下,选择 Create(创建)。
-
输入 webhook 信息并选择 Save and Test(保存并测试)。
-
要创建通知,从 Notifications(通知) 页面选择 All Notifications(所有通知) 选项卡。
-
在 Notifications(通知) 旁边,选择 Add(添加)。
-
在产品列表中找到 Stream 并选择 Select(选择)。
-
输入名称和可选描述。
-
在 Webhooks(Webhook) 下,选择 Add webhook(添加 webhook) 并选择您新创建的 webhook。
-
选择 Next(下一步)。
-
默认情况下,您将收到所有 Live Inputs 的 webhook 通知。如果仅希望接收某些输入的 webhooks,在文本字段中输入逗号分隔的 Input ID 列表。
-
完成后,选择 Create(创建)。
{
"name": "Live Webhook Test",
"text": "Notification type: Stream Live Input\nInput ID: eb222fcca08eeb1ae84c981ebe8aeeb6\nEvent type: live_input.disconnected\nUpdated at: 2022-01-13T11:43:41.855717910Z",
"data": {
"notification_name": "Stream Live Input",
"input_id": "eb222fcca08eeb1ae84c981ebe8aeeb6",
"event_type": "live_input.disconnected",
"updated_at": "2022-01-13T11:43:41.855717910Z"
},
"ts": 1642074233
}data 对象的 event_type 属性将为 live_input.connected、live_input.disconnected 或 live_input.errored。
如果检测到输入问题,event_type 将为 live_input.errored。额外数据将在 live_input_errored json 键下,并包含下面列出的值之一的 code。
ERR_GOP_OUT_OF_RANGE– 输入 GOP 大小或关键帧间隔超出范围。ERR_UNSUPPORTED_VIDEO_CODEC– 输入视频编解码器对于所用协议不受支持。ERR_UNSUPPORTED_AUDIO_CODEC– 输入音频编解码器对于所用协议不受支持。ERR_STORAGE_QUOTA_EXHAUSTED– 账户存储配额已超出。删除旧内容或购买额外存储。ERR_MISSING_SUBSCRIPTION– 无权开始直播。请检查订阅或登录 Dash 了解详情。ERR_UNHEALTHY– 当前直播因未知原因无法处理,最常见的原因是编码器配置错误。请确认直播符合必需和建议的设置,然后断开连接并重新连接以再次尝试。
{
"name": "Live Webhook Test",
"text": "Notification type: Stream Live Input\nInput ID: 2c28dd2cc444cb77578c4840b51e43a8\nEvent type: live_input.errored\nUpdated at: 2024-07-09T18:07:51.077371662Z\nError Code: ERR_GOP_OUT_OF_RANGE\nError Message: Input GOP size or keyframe interval is out of range.\nVideo Codec: \nAudio Codec: ",
"data": {
"notification_name": "Stream Live Input",
"input_id": "eb222fcca08eeb1ae84c981ebe8aeeb6",
"event_type": "live_input.errored",
"updated_at": "2024-07-09T18:07:51.077371662Z",
"live_input_errored": {
"error": {
"code": "ERR_GOP_OUT_OF_RANGE",
"message": "Input GOP size or keyframe interval is out of range."
},
"video_codec": "",
"audio_codec": ""
}
},
"ts": 1720548474,
}