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
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 )
(function() {
var user_name, api_key, twitch_widget;
user_name = “user”;
api_key = “5j0r5b7qb7kro03fvka3o8kbq262wwm”;
twitch_widget = $("#twitch-widget");
twitch_widget.attr(“href”,“http://twitch.tv/” + user_name);
$.getJSON(‘https://api.twitch.tv/kraken/streams/’ + user_name + ‘?client_id=’ + api_key + ‘&callback=?’, function(data) {
if (data.stream) {
twitch_widget.html("<div id=bodytwitch><div id=twitch><iframe src='http://www.twitch.tv/user/embed' 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 !