跳转到内容
搜索文档

接收 Live Webhooks

最后更新 查看 MarkdownAgent 设置

Stream Live 提供 webhooks,在 Input 连接、断开或与 Stream Live 遇到错误时通知您的服务。

Stream Live Notifications

Who is it for?

Customers who are using Stream and want to receive webhooks with the status of their videos.

Other options / filters

You can input Stream Live IDs to receive notifications only about those inputs. If left blank, you will receive a list for all inputs.

The following input states will fire notifications. You can toggle them on or off:

  • live_input.connected
  • live_input.disconnected

Included with

Stream subscription.

What should you do if you receive one?

Stream notifications are entirely customizable by the customer. Action will depend on the customizations enabled.

订阅 Stream Live Webhooks

  1. 在 Cloudflare 仪表板中,前往 Notifications(通知) 页面。

    Go to Notifications ↗
  2. 选择 Destinations(目标) 选项卡。

  3. Destinations(目标) 页面的 Webhooks(Webhook) 下,选择 Create(创建)

  4. 输入 webhook 信息并选择 Save and Test(保存并测试)

  5. 要创建通知,从 Notifications(通知) 页面选择 All Notifications(所有通知) 选项卡。

  6. Notifications(通知) 旁边,选择 Add(添加)

  7. 在产品列表中找到 Stream 并选择 Select(选择)

  8. 输入名称和可选描述。

  9. Webhooks(Webhook) 下,选择 Add webhook(添加 webhook) 并选择您新创建的 webhook。

  10. 选择 Next(下一步)

  11. 默认情况下,您将收到所有 Live Inputs 的 webhook 通知。如果仅希望接收某些输入的 webhooks,在文本字段中输入逗号分隔的 Input ID 列表。

  12. 完成后,选择 Create(创建)

Webhook 负载示例json
{
  "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.connectedlive_input.disconnectedlive_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 了解详情。
live_input.errored webhook 负载示例json
{
  "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,
}

这篇文档对您有帮助吗?