Skip to content
Advertisement

Hide Twitch iFrame If Channel Not Live

We have a site embedding Twitch streams. They have events for a channel going offline. So when a stream is live, then it goes offline, I can essentially then hide the iframe. However, I’m wanting to have it so if when the page is loaded, and the channel is already offline, the iframe doesn’t show.

Any ideas and thoughts much appreciated.

Thanks in advance!

Advertisement

Answer

You probably already posted the solution yourself.
In the link you posted there’s a js call you can use to get the state of the stream.

getEnded():Boolean

You probably can use this to show/hide your iframes.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement