【问题标题】:Getting 500 - Internal Error Encountered with Youtube Broadcast Insert API获得 500 - Youtube 广播插入 API 遇到内部错误
【发布时间】:2020-10-15 21:21:07
【问题描述】:

我正在尝试使用 Youtube LIVE 流 API 插入 LiveBroadcast。

这是我在youtube API docs API 操场上提出的请求

POST https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet%2C%20id%2C%20status%2C%20contentDetails&key=[YOUR_API_KEY] HTTP/1.1

Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json

{
  "contentDetails": {
    "enableClosedCaptions": true,
    "enableEmbed": true,
    "enableLowLatency": true,
    "recordFromStart": true,
    "enableAutoStart": true,
    "enableAutoStop": true
  },
  "status": {
    "privacyStatus": "public",
    "selfDeclaredMadeForKids": true,
    "liveBroadcastPriority": "high",
    "madeForKids": true
  },
  "snippet": {
    "title": "My broadcasst",
    "description": "My Description",
    "scheduledStartTime": "2020-06-177T03:48:46.46Z",
    "scheduledEndTime": "2020-06-178T11:48:52.52Z"
  }
}

我得到的响应

{
  "error": {
    "code": 500,
    "message": "Internal error encountered.",
    "errors": [
      {
        "message": "Internal error encountered.",
        "domain": "global",
        "reason": "backendError"
      }
    ],
    "status": "INTERNAL"
  }
}

任何帮助将不胜感激。提前致谢

【问题讨论】:

    标签: android youtube-api youtube-data-api youtube-livestreaming-api


    【解决方案1】:

    错误是我从 google docs 复制的 ISO-8601 格式的时间格式字符串,提到了所有与时间相关的字段。我建议从 here 为 java 代码创建格式字符串

    【讨论】:

      【解决方案2】:

      根据the docs,您不应该提供makeForKids 属性(这是API 的工作)。

      当调用liveBroadcasts.insert 端点时,如果想将相应的广播指定为儿童导向,你应该使用这个属性来代替:

      status.selfDeclaredMadeForKids (布尔值)

      在 liveBroadcasts.insert 请求中,此属性允许频道所有者将广播指定为面向儿童的。在 liveBroadcasts.list 请求中,仅当频道所有者授权 API 请求时才返回属性值。

      您不应该设置的其他属性是enableLowLatencyliveBroadcastPriority

      【讨论】:

      • 我更新了有效载荷,仍然得到 500 { "contentDetails": { "enableClosedCaptions": true, "enableEmbed": true, "recordFromStart": true, "enableAutoStart": true, "enableAutoStop": true },“status”:{“privacyStatus”:“public”,“selfDeclaredMadeForKids”:true },“sn-p”:{“title”:“我的广播”,“description”:“我的描述”,“scheduledStartTime ": "2020-06-177T03:48:46.46Z", "scheduledEndTime": "2020-06-178T11:48:52.52Z" } }
      • 您能否也修复计划日期时间值,因为它们无效。
      猜你喜欢
      • 2016-10-15
      • 1970-01-01
      • 2018-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-05
      • 1970-01-01
      • 2017-01-05
      相关资源
      最近更新 更多