2

My company runs a live web stream and has started duplicating this to YouTube. Unfortunately the staff won't check if it's live and internet issues cause our web encoder to stop encoding at times.

Is there a programmatic way I can tell if a channel is ACTUALLY streaming? i.e. if live video is coming out the channel and not just that "the channel is live"?

user1120058
  • 91
  • 2
  • 7

1 Answers1

1

You may use Search: list.

Using this request returns a collection of search results that match the query parameters that you have specified in the API request. Add part=snippet in your request since this is a required parameter. Then, you may add the following optional parameters with their corresponding values in your HTTP request:

  • channelId=[channelId] - to search resources created by a particular channel.
  • type=video - to retrieve a particular type of resource
  • eventType=live - to return only active broadcasts. Please note that if you use eventType, also set the type parameter's value to video.

Combining all of these parameters, you may send HTTP request using the following format:

https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCXswCcAMb5bvEUIDEzXFGYg&type=video&eventType=live

To better filter your search, you may also opt to add more parameters that are listed in supported parameters.

Lastly, solution in this related SO post - How to check if YouTube channel is streaming live might also help.

Community
  • 1
  • 1
Teyam
  • 7,686
  • 3
  • 15
  • 22
  • 1
    I tried this, if I start the event but don't broadcast any video the results still contain the stream. This lists based on if the event is active or not rather than any video content. – user1120058 Oct 05 '16 at 17:16
  • Can you please share what you already have done and also any encountered error/s? – Teyam Oct 05 '16 at 17:22