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 !