Dmitrii Salenko
Dmitrii Salenko

Reputation: 21

How to create persistent livebroadcast?

I develop the mobile app with livestream feature and I need to get default livebroadcast with default livestream data.

When user didn't enable livestreams in his youtube account I show him message with link to https://www.youtube.com/live_streaming_signup .

After if user enabled livestreams in his youtube account I can't get default livebroadcast with broadcast type persistent.

My request url is: https://www.googleapis.com/youtube/v3/liveBroadcasts?part=contentDetails&mine=true&broadcastType=persistent&access_token=

My response is:

{
 "kind": "youtube#liveBroadcastListResponse",
 "etag": "\"I_8xdZu766_FSaexEaDXTIfEWc0/5WQLBG6RLCbLPgwsAs3o13sBM98\"",
 "pageInfo": {
  "totalResults": 0,
  "resultsPerPage": 5
 },
 "items": [
  {
   "kind": "youtube#liveBroadcast",
   "etag": "\"I_8xdZu766_FSaexEaDXTIfEWc0/vyGp6PvFo4RvsFtPoIWeCReyIC8\""
  }
 ]
}

Only after go to live dashboard page stream now I can got default livebroadcast with broadcast type persistent and then got livestream by default livebroadcast boundStremId

Why? How I can get default livebroadcast and default livestream without go to livestream dashboard?

Upvotes: 2

Views: 884

Answers (1)

KENdi
KENdi

Reputation: 7741

I tried your query, and just like you, I can get 200 response, but I can only get 1 result. So the alternative way that I used to get the live broadcast is by using the Search: list under the DATA API. Here, you can use the eventType=live to get the live broadcast video.

GET https://www.googleapis.com/youtube/v3/search?part=snippet&eventType=live&type=video&key={YOUR_API_KEY}

For the persistent broadcast, try to check this SO question if it can help you.

For more information check these related SO questions:

Upvotes: 0

Related Questions