Getting realtime information about live streaming on YouTube

Viewed 326

I am building a webpage to display the live streaming status of several YouTube channels which I do not manage. The page will display a list of selected channels, with a ● red dot beside any channel which is live streaming right now. I also want the webpage to update that status in realtime, so if a channel begins live streaming, I need to immediately add the dot, and when a channel stops live streaming, I need to immediately remove the dot.

I can use the Data API to:

  • find upcoming events on a channel, using the search endpoint with a channelId, type=video and eventType=upcoming
  • retrieve the scheduledStartTime of an upcoming event, using the videos endpoint with part=liveStreamingDetails
  • find live events on a channel, using the search endpoint with a channelId, type=video and eventType=live
  • retrieve the actualStartTime of a live event, using the videos endpoint with part=liveStreamingDetails
  • retrieve the actualEndTime of a completed event, using the videos endpoint with part=liveStreamingDetails

I would really like to avoid polling the videos endpoint to monitor the status of live streams. Can I subscribe to a set of channel IDs or video IDs, to receive a message in real time when:

  • when an upcoming event actually starts live streaming
  • when a live stream is completed/terminated
  • for channels which I don't manage?

Is this possible?

0 Answers
Related