i trying to know if my channel is streaming on youtube. I'm using the youtube api v3 with the php library. I'm able to get the last broadcasts with liveBroadcasts.list but when I start streaming with OBS I put the parameters broadcastStatus = active and nothing is returned. I also tried with liveStreams.list but I still get nothing. I don't know what I'm doing wrong, can someone explain me please ? :D
Asked
Active
Viewed 1,148 times
3 Answers
0
The request url is :
GET https://www.googleapis.com/youtube/v3/liveBroadcasts?part=id%2Csnippet%2Cstatus&mine=true&broadcastStatus=active&key={YOUR_API_KEY}
you should receive :
{"status":{ "lifeCycleStatus":"live"}}

Sofiene Djebali
- 4,398
- 1
- 21
- 27
0
Try to use the search.list
, Here you can set the optional parameters to search what you need. Like the channelId
, eventType
that you can set to live to include active broadcast, and type
parameter that restricts a search query to only retrieve a particular type of resource.
Read the other parameters
to know more about its purpose and description.
For more information you can also check this SO question:
0
You can use the search API - something like this:
https://www.googleapis.com/youtube/v3/search?part=id&channelId={CHANNEL_ID_YOU_WANT_TO_QUERY}&type=video&key={YOUR_API_KEY}&eventType=live
However, this might take 3-5 minutes before it shows the Video ID of broadcast video after the broadcast has started. This has been discussed in another StackOverflow Question: Using YouTube API v3 to tell if a channel has a live stream

Community
- 1
- 1

Savio Sebastian
- 78
- 10