[Web Dev] Help with a few things please

Basically, on my website I got multiple streams.
But I think I got it kind of messy.

What I did is, I’m using a js file that checks whether the user is streaming or not.

http://pastebin.com/g9SqTTth

looks like this

So this basically displays whether they are online or not.
In addition, I use jquery tabs wherein each tab I got the users twitch embedded.

I just feel this is inefficient and thought there has to eb a better way to this. Anyone has any ideas to improve this?
In addition I would like to add the twitch chat and a follow channel button in the jquery tabs together with the twitch channel.

Hopefully anyone could help me.

What feels inefficient about this to you? The unminified source code is at https://github.com/Fugiman/Twitch-Channel-Status/blob/master/twitch-channel-status.js which shows that the online status of all streams are fetched at once, so it should be fairly efficient.

You can embed chat easily by using an iframe with src="http://www.twitch.tv/CHANNEL_NAME/chat". A follow button is much more complicated.

Well, I’m wondering if over a 100 people watch the stream from one embedded player and 100+ watch another, will that not create lagg by all those requests?

That’s not how a website works. For a server hosting a web page with an embedded stream it only does minimal work two times. Once when the page layout is requested and the other when the API request returns. The actual audiovisual content never pass through your server, it is only between Twitch servers and your visitors. It is only when/if your server receives many page load requests from many visitors at the same time that it becomes stressed.

EDIT: with javascript/jquery the clients browser will handle the entire api request client side so that means even less work for your server. It will only provide a few written documents of html + js at a few kilobytes.

1 Like

Thanks a lot for the reply, very useful to know.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.