1

I had created an live event on youtube and i had associated a custom ingestion (live stream) to that live event.

I am able to get the list of live events by calling

https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet&broadcastStatus=all

Response

{
 "kind": "youtube#liveBroadcastListResponse",
 "etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/6LS8J5LIkMcXRAIUEViaRonO_jk\"",
 "items": [
  {

   "kind": "youtube#liveBroadcast",
   "etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/eSW3gnAC5A4iNg4xj-r8vvP4ha8\"",
   "id": "M96Pswa174I",
   "snippet": {
    "publishedAt": "2015-08-27T09:26:52.000Z",
    "channelId": "UCx_ZkmygOl4Bc0PHV8zXeag",
    "title": "My new event",
    "description": "This is test event",
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/vi/M96Pswa174I/default_live.jpg",
      "width": 120,
      "height": 90
     },
     "medium": {
      "url": "https://i.ytimg.com/vi/M96Pswa174I/mqdefault_live.jpg",
      "width": 320,
      "height": 180
     },
     "high": {
      "url": "https://i.ytimg.com/vi/M96Pswa174I/hqdefault_live.jpg",
      "width": 480,
      "height": 360
     }
    },
    "scheduledStartTime": "2015-08-27T09:30:00.000Z",
    "isDefaultBroadcast": false
   }
  }
 ]
}

then i am able to get the live stream by calling

https://www.googleapis.com/youtube/v3/liveStreams?part=cdn%2Csnippet&mine=true

Response

- SHOW HEADERS -
{
 "kind": "youtube#liveStreamListResponse",
 "etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/ctbzD5B9MI-wBMxDXCWCto2oFO8\"",
 "pageInfo": {
  "totalResults": 1,
  "resultsPerPage": 5
 },
 "items": [
  {

   "kind": "youtube#liveStream",
   "etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/LEFmnjMqvHydtqmxovlaXCai3vM\"",
   "id": "x_ZkmygOl4Bc0PHV8zXeag1440668944469033",
   "snippet": {
    "publishedAt": "2015-08-27T09:49:04.000Z",
    "channelId": "UCx_ZkmygOl4Bc0PHV8zXeag",
    "title": "My new stream",
    "description": "this is demo stream",
    "isDefaultStream": false
   },
   "cdn": {
    "format": "720p_hfr",
    "ingestionType": "rtmp",
    "ingestionInfo": {
     "streamName": "rathodm63.6584-jszu-8p4h-43yg",
     "ingestionAddress": "rtmp://a.rtmp.youtube.com/live2",
     "backupIngestionAddress": "rtmp://b.rtmp.youtube.com/live2?backup=1"
    }
   }
  }
 ]
}

but how to identify that this steam belongs to above specified live event ?

4

1 に答える 1

1

LiveBroadcasts.bindYouTube ブロードキャストをストリームにバインドするには、 を使用する必要があります。ビデオ ストリームは複数のブロードキャストにバインドできますが、ブロードキャストは 1 つのビデオ ストリームにしかバインドできないことに注意してください。次に、LiveBroadcasts.listリクエストを使用して を確認できますcontentDetails.boundStreamId。これは、そのライブブロードキャストに関連付けられたストリームになります。part=contentDetailsこれを HTTP リクエストで行うかどうかを指定する必要があります。

于 2015-09-01T22:36:55.523 に答える