justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 381 forks source link

New Player - get online status? #508

Closed jzisser9 closed 8 years ago

jzisser9 commented 8 years ago

Hi, first off, great job on the new interactive player - it's a huge step forward.

Is there a way to detect whether a player's channel is online or offline? I see the "isEnded()" method but it returns false, even for offline channels. I'm guessing this is only set to "true" if a channel goes from online to offline during the lifetime of the player.

Additionally, is there an event listener for when a streamer goes online?

bofinbabu commented 8 years ago

Any leads ?

tmaneri commented 8 years ago

You can use the streams endpoint to detect if a channel is live or not.

On Tue, May 10, 2016 at 5:24 AM Bofin Babu notifications@github.com wrote:

Any leads ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/justintv/Twitch-API/issues/508#issuecomment-218141704

jzisser9 commented 8 years ago

That's what I'm currently using, but there's a noticeable delay between noticing the stream go offline in an embedded player and the API returning that fact. Being able to grab this info from the player - maybe based on whether or not the embedded player is playing something - would be better.

bofinbabu commented 8 years ago

@Argus9 : I've noticed the same too. I tried to fetch contents of the channel's url and parsed it to see if there's any difference while the channel is live and when it's offline. But couldn't find any.

jzisser9 commented 8 years ago

Closing issue; you can use addEventListener to detect when a stream comes online or goes offline.