We need a update for this script. Can someone help?
function twitchStream() {
twitch_widget.attr(“href”,“https://twitch.tv/” + user_name);
$.getJSON(‘https://api.twitch.tv/kraken/streams/’ + user_name + ‘?client_id=’ + api_key + ‘&callback=?’, function(data) {
if (data.stream) {
if (recntStatChange == 0) {
$( “#livestream, #livestream-button, #livestream iframe” ).removeClass( “hidetwitch” );
visitOffline = 1;
setTimeout(recntAndRefresh, long);
//Displayed the iframe and the user is streaming, refresh period set to long
}
if (recntStatChange == 1) {
setTimeout(refresh, short);
//Refresh period set to short, streaming
}
}
else {
if (recntStatChange == 1) {
$( “#livestream, #livestream-button, #livestream iframe” ).addClass( “hidetwitch” );
$iframe = $( “#livestream, #livestream-button” ).find( “iframe” );
$iframe.attr( “src”, $iframe.attr( “src” ));
setTimeout(recntAndRefresh, long);
//Hid the stream, did a reset on iframe so that the visitor won’t hear any audio if you’d go online again and the twitch-player hasn’t shown yet, refresh period set to long
}
if (recntStatChange == 0) {
if (visitOffline == 0) {
visitOffline = 1;
setTimeout(refresh, long/2);
//The user isn’t streaming and just entered, refresh timeout is set to long divided by 2.
}
else {
//The user isn’t streaming, and the visitor has been here for the widget to update at least once, refresh period set to short
setTimeout(refresh, short);
}
}
}
});
};