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.