Hi,
I am using the Twitch API to get the status of the channel, however it shows as offline, when the channel in hosting another channel. The code is below.
Is there away to get the script to display as Online, whne it being used to hosted another channel or streaming
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
var twitchUserName = 'TWITCH_CHANNEL'
$(document).ready(function() {
$.getJSON("https://api.twitch.tv/kraken/streams/"+twitchUserName+"?callback=?",function(streamData) {
console.log('Stream Data:', streamData)
if (streamData && streamData.stream) {
$('#streamWidget').html("Online")
} else {
$('#streamWidget').html("Offline")
}
})
});
</script>
<div id='streamWidget' style="text-align:center;">querying twitch</div>
Thanks