LiveBroadcast 对象的图像缩略图 [英] Image thumbnails for a LiveBroadcast object

查看:37
本文介绍了LiveBroadcast 对象的图像缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试通过 API 创建实时流时,我似乎无法根据文档将图像缩略图与 LiveBroadcast 对象相关联.

I can't seem to associate image thumbnails with a LiveBroadcast object as per the documentation when trying to create a live stream via the API.

对于我的应用程序,我使用以下参考:

For my application, I am using the following reference:

https://developers.google.com/youtube/v3/live/docs/liveBroadcasts#snippet.thumbnails

这是我发送到 /liveBroadcasts 的负载示例:

Here's an example of my payload sent to /liveBroadcasts:

array:3 [
  "snippet" => array:5 [
    "title" => "Test broadcast"
    "description" => "Test description",
    "thumbnails" => array:1 [
      "default" => array:3 [
        "url" => "my-image"
        "width" => 120
        "height" => 90
      ]
    ]
    "scheduledStartTime" => "2021-03-01T21:35:37.000000Z"
    "scheduledEndTime" => "2021-03-01T21:40:37.000000Z"
  ]
  "contentDetails" => array:2 [
    "enableAutoStart" => true
    "enableAutoStop" => true
  ]
  "status" => array:1 [
    "privacyStatus" => "public"
  ]
]

my-image 的 URL 实际上是一个有效的 URL.

The URL to my-image of course is actually a working URL.

thumbnails 中的图片是否必须事先上传到 YouTube 并托管在那里?我还能缺少什么?

Must the images in thumbnails be previously uploaded to YouTube and hosted there instead? What else could I be missing?

谢谢!

推荐答案

根据 LiveBroadcasts.insertLiveBroadcasts.update API 端点,您不能在调用任一直播资源对象时设置相应的直播资源对象的 thumbnails 属性这些端点:

According to the official specs of the LiveBroadcasts.insert and LiveBroadcasts.update API endpoints, you're not allowed to set the respective live broadcast resource object's thumbnails property when invoking either of these endpoints:

请求正文前一个端点,也不是 请求正文后者在接受初始化或修改的那些中指定了属性thumbnails.

Neither the request body of the former endpoint, nor the request body of the latter one has specified the property thumbnails among those accepted to be initialized or, respectively, modified.

要更新直播的缩略图,您必须使用Thumbnails.set API 端点,使用其请求参数适当调用 videoId 设置为 ID 您的广播.

For to update your live broadcast's thumbnails, you have to use the Thumbnails.set API endpoint instead, invoked appropriately with its request parameter videoId set to the ID of your broadcast.

对于 PHP(虽然从您的帖子中不清楚您的编程语言/环境是什么),请查找使用 Thumbnails.set 将缩略图上传到 YouTube 的官方 Google 示例代码:upload_thumbnail.php.

For PHP (though it's not clear from your post what's your programming language/environment), look for the official Google sample code that is uploading thumbnails to YouTube using Thumbnails.set: upload_thumbnail.php.

这篇关于LiveBroadcast 对象的图像缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆