I was called upon today by a new friend to write a small script to detect the streaming status of a uStream.tv channel. I thought I”d share the script with everyone.
****OK OK, My CodeBox plugin is not working, please be patient.****
<!--Place this code where you want the status to appear. -->
<font color='red'><span id="status">status</span></font>
<!--Place this code anywhere in the page. -->
<script type="text/javascript">
function set_status(status)
{
if (status == "offline")
{ <!-- replace the img html with any html that you need -->
document.getElementById("status").innerHTML = "<img src='http://lifeofajackass.com/offline.png'/>";
}
else if (status == "live")
{ <!-- replace the img html with any html that you need -->
document.getElementById("status").innerHTML = "<img src='http://lifeofajackass.com/online.png'/>";
}
else
{ <!-- Let's do this just in case the service is down or something. You could show an error image as well -->
document.getElementById("status").innerHTML = "Error getting stream status!";
}
}
</script>
<!--Make sure to replace the channel name and API key. -->
<script type="text/javascript" src="http://api.ustream.tv/json/channel/CHANNELNAME/getValueOf/status?key=YOURAPIKEY&callback=set_status">
</script>











































hey there ! i’m sorry to raid in on ur blog , but i need a favor to ask
3 months ago you helped someone on wordpress forums , i need exact same help
here’s the link to that topic , plz help if you can –
http://wordpress.org/support/topic/263254
i’m also using theme “vigilance” – the latest one and i also want it to look like the wordpress.com version with a width size header !
i tried replacing the header.php – with the modified one as per above given code , also placed “logo.jpeg” image in image folder – but it just don’t work !!
the link bar gets shifted to right with “h written before home (syntax error – i guess – but i dunno anything bout coding) and strangely the header image appears for a second but then disappears !
my .org blog with the problem is http://fribbles.iblogger.org/
and my .com blog , which is perfect is http://apoo1.wordpress.com/
also , can you can help me remove the right sidebar image ?
i guess it’s too much to ask – but any help is appreciated , thanks!
thanks for the post!
Pingback: uStream.tv Status (Java Script) :Life Of A Jackass Scripts Rss
Where do I find my API key?
Does this script still work? An expression is returned from the API which seems to be the cause of a Javascript error that I cant get rid of.