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

查看:81
本文介绍了如何获取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.

我也在做一个流媒体应用程序,我正在寻找的是获取默认"Stream now"流的流名称的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 广播(snippet.isDefaultBroadcast)中应该有一个isDefault字段.并且应该有一个默认的广播和默认的实时流.

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天全站免登陆