Stream-Status embed

Hello Everybody !

I’ve just startet to try to make a HTML website -> Im not a good coder, so dont expect that ive done anything right :stuck_out_tongue:

Now my Problem ! I want my Java skrip to check if a Streamer is online, If the streamer is online if true i want it to show a embed stream player if not i want it to show a youtube video.

I searched in the internet for something like that and i found something which ive modified, but it wont work (Im really not good at this :smiley: )

(function() {

var user_name, api_key, twitch_widget;

user_name = “user”;
api_key = “5j0r5b7qb7kro03fvka3o8kbq262wwm”;
twitch_widget = $("#twitch-widget");

twitch_widget.attr(“href”,“” + user_name);

$.getJSON(‘’ + user_name + ‘?client_id=’ + api_key + ‘&callback=?’, function(data) {
if ( {
twitch_widget.html("<div id=bodytwitch><div id=twitch><iframe src='' frameborder='0' scrolling='no' height='510' width='853'></iframe></div></div>");
} else {
twitch_widget.html("<div id=bodyyt>Embed link YT Video </div>");


and in the html data ive used this:

<script src="twitch-widget.js"></script>
<a href="#" class="twitch-widget" id="twitch-widget" target="_blank"></a>"

any ideas to make this work ?

Sorry for my bad English guys and thanks !

I’m going to assume you didn’t set the user. Since you left the api_key in the post, I bet you didn’t purposely set
user_name = “user”;
So change “user” to the streamer name.

I know i have to set the user, just dont want to write it because its not my username, and the api key is from This Guy

Please generate your own API key.
You can generate an API key by registering your own application here.

I assume your problem here is that you have not initialized jQuery and the fact that you are not using your own API key.

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