2

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

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

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 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.

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

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

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.

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": [
 ]
}

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

4

1 回答 1

6

已解决,可以通过在livebrocasts.list中将broadcastType设置为“persistent”来检索默认广播。

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

并且可以通过带有boundstreamid 的livestreams.list 检索默认流。

于 2016-02-11T01:52:00.470 回答