Find out if stream is live

Hello,

maybe I’m blind, but I’m searching an option to find out in my (viewer)Panel extension if the streamer on which page the extension is shown is online/offline and if the stream is live or replay or it is a hostet stream.
Can’t find it in onContext.

Can anyone help?
Our extension needs to know if the strem is online AND live from the original streamer.

You need to use the live activated extension endpoint detailed here:

However that endpoint does say whether it’s a vodcast or live, so you’ll have to combine it with the streams endpoint and check the type responses:

i currently do the first thing to check the live activated extensions endpoint. however the issue of vodcast came up, and only way i know how to do it is as you suggested. however im afraid of the rate limits. say a streamer has 10,000 people hit a page with this extension, as far as i know live activated extensions isnt rate limited so it was safe, but new twitch api definitely is rate limited (30 for non bearer 120 for bearer)?

I also suggested a long time ago for the onContext - context object tell us wether the streamer is live, hosting, vodcasting but it was never added.

You should definitely not be hitting an endpoint every time a viewer loads the stream. Cache the result in your EBS, update it every so often.

That is also the problem I see at this point.
Our extension needs the information if streamer is live in realtime. If the stream goes offline, the extension have to change its content directly.
To reach that we have to poll this information very often, what is not such a good solution.

We can do the polling of the information in our EBS and send the updates to the extension panels if there is a change. That minimizes the number of requests on API, but its still not a smart solution.

I would probably not recommend designing your extension to need to-the-second accuracy. The live extensions endpoint is pretty quick to updated, I’d say probably <1min, so I’d probably try and build around that.

If absolutely need a higher level of accuracy, I’d probably have your backend monitor the stream feed for each channel you’re installed on and notify your extension whenever the broadcast cuts. However that’s probably going to use a lot of bandwidth and a decent amount of computational grunt.

We try to call
https://api.twitch.tv/extensions/[extension ID]/live_activated_channels

But if I add for [extension ID] the 6 digit Extension ID which is displayed in developer dashboard, I get response 400 - Bad request “No client id specified”

If I additionally add the client-ID in the request Header, I get 404 - Not Found “The record was not found”

If I call
https://api.twitch.tv/extensions/[client-ID]/live_activated_channels
(that is shown in the example of documentation) I get the same 404 error. Independent if I put the client-ID additionally in the header or not.

What I do wrong?

The second way is correct. Unfortunately, Twitch currently makes that endpoint 404 until your extension is released. For now, you should use a placeholder function (that just returns your testing channel ID), then switch to the real function once your extension is live. You can also go and comment in the other threads on this and tell the Twitch team it’s causing you problems!