如何获取 YouTube Live“立即流"的流名称/密钥服务 [英] How to get stream name/key of YouTube Live "Stream Now" service

查看:12
本文介绍了如何获取 YouTube Live“立即流"的流名称/密钥服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

YouTube 去年 7 月添加了立即直播(测试版)"服务,让直播变得更加容易.

YouTube added "Stream now (beta)" service last July which makes live streaming much easier.

使用经过 Youtube 验证的节目,如XSplit Broadcaster",您可以在授权后流式传输到立即流式传输".

Using Youtube verified programs like "XSplit Broadcaster" you can stream to "Stream now" after authorization.

我也在做一个流应用程序,我正在寻找的是获取默认现在流"流的流名称的 API.使用流名称,我可以将内容流式传输到 YouTube.

I'm also doing a streaming application and what I'm looking for is the API to get the stream name of the default "Stream now" stream. With the stream name I can stream content to YouTube.

YouTube 文档 https://developers.google.com/youtube/v3/live/docs/ 没有提及任何相关内容,并且默认广播不包含在 youtube.liveBroadcasts.list 的结果中.

YouTube documentation https://developers.google.com/youtube/v3/live/docs/ doesn't mention anything about it, and the default broadcast is not included in the result of youtube.liveBroadcasts.list.

如果 XSplit Broadcaster 可以做到,我想一定有一个 API 可以做到.有人知道吗?

If XSplit Broadcaster can do it, I think there must have an API for it. Anyone knows it?

=====================================更新:

==================================== Update:

在此处形成文档 https://developers.google.com/youtube/v3/live/docs/liveBroadcasts广播中应该有一个 isDefault 字段(snippet.isDefaultBroadcast).并且应该有默认的广播和默认的直播.

Form the documentation here https://developers.google.com/youtube/v3/live/docs/liveBroadcasts there should be a isDefault field in a Broadcast (snippet.isDefaultBroadcast). And there should be a default broadcast and default live stream.

但是当我运行 livebroadcasts.list 来获取所有广播时,我得到了

But when I ran livebroadcasts.list to get all broadcasts, I got

{
 "kind": "youtube#liveBroadcastListResponse",
 "etag": ""abQHWywil_AkNqdqji7_FqiK-u4/z2Ncj_KliOCAGV1jEVPYCsHbZn0"",
 "pageInfo": {
  "totalResults": 4,
  "resultsPerPage": 50
 },
 "items": [
 ]
}

虽然totalResults = 4,但返回的项目中没有任何内容.

Although the totalResults = 4, there's nothing in returned items.

推荐答案

已解决,可以通过在livebrocasts.list中设置broadcastType为persistent"来获取默认广播.

Solved, the default broadcast can be retrieved by setting broadcastType to "persistent" in livebrocasts.list.

GET https://www.googleapis.com/youtube/v3/liveBroadcasts?part=+id%2C+snippet%2C+contentDetails%2C+status&broadcastType=persistent&mine=true&key={YOUR_API_KEY}

并且可以通过 livestreams.list 和 boundstreamid 检索默认流.

And default stream can be retrieved by livestreams.list with boundstreamid.

这篇关于如何获取 YouTube Live“立即流"的流名称/密钥服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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