I am able to get the list of live stream: https://developers.google.com/youtube/v3/live/docs/liveStreams/list#examples But how to get the live stream status and live stream link or id for particular channel using youtube v3 api in android?
I have faced the same problem and managed to figure out a solution for the same. YouTube actually provides an API for this purpose. You can use the search API to get the currently active Live Video ID, if you have the channel ID.
Use the following API:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={YOUR_CHANNEL_ID}&eventType=live&type=video&key={YOUR_API_KEY}
The key factor here is you have to set the eventType
to live
and type
to video
.
For getting the channel ID, you can use the following request, if you have the channel's username.
https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername={CHANNEL_USER_NAME}&key={YOUR_API_KEY}