View Full Version : DOM XMLTicker: Refresh advice please

07-10-2005, 10:23 PM

I'm a bit stuck with an issue regarding this great script! I am engineering a webplayer for an internet stream, and the artist and track title get uploaded to the server after every song change in xml format.

In the player that I have devised, the data shows in the player through your xml script, and it displays fine, but it doesn't update after the song change, when the update is uploaded to the server.

Is there anyway that I can make this happen??? the player address is www.qmusicradio.co.uk/player

Thanks in advance for any help!


07-11-2005, 08:19 AM
I must have caught it at an odd time or you are mistaken, the contents of the file remained as:

<?xml version="1.0" ?>
- <xmlticker>
- <message>
- <![CDATA[ Kevin Coy
- <message>
- <![CDATA[
<message>Q Music Radio</message>
<message>The Hottest Hits of Summer 2005!</message>
</xmlticker>No matter what was playing. Even if the contents of this file were to change, the page may have to be refreshed (which would be unacceptable in this situation) to load the new file.

07-11-2005, 10:09 AM
You did catch it at a bad time!! When a live DJ is on air, the data won't change, but when DJ's change, the data needs to update in the player.

07-11-2005, 10:48 AM
Well then, this looks suspect:

var refreshID = "";
refreshID = setTimeout("DoRefresh()", $timeout$);

function DoRefresh()
var buster = Math.random();
document.location.href = 'http://www.qmusicradio.co.uk/songinfo.asp?buster='+buster;
</SCRIPT>That's only going to happen once, or possibly not at all, if $timeout$ is undefined. Try using setInterval and putting a real number in there instead of $timeout$, like 500, for every half second. Still, I think the result of that will be to replace the entire page with:

'http://www.qmusicradio.co.uk/songinfo.asp?buster='+buster;This thing use an iframe? Not as far as I can see. Anyways, I think you would be better off scrapping the entire above script and putting these lines of code:

var refreshID = "";
refreshID = setInterval("DoRefresh()", 500);

function DoRefresh(){
if xmlsource not different
var buster = Math.random();
xmlsource = 'http://www.qmusicradio.co.uk/songinfo.asp?buster='+buster;
if (window.ActiveXObject)
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
else if (document.implementation && document.implementation.createDocument)
var xmlDoc= document.implementation.createDocument("","doc",null);
if (typeof xmlDoc!="undefined"){
}just after this line:

var amWaiting = 0;Still, we need to have a way of determining if the xml doc has changed (represented as red in the above code). If you have a way of doing that, it could work out well.

07-11-2005, 04:13 PM
Thank you for your code, i put it in where you said, but it gives me an error message in frontpage, and won't load the XML script at all.


07-11-2005, 04:15 PM
on another note, i notice that www.passionradio.co.uk have managed it somehow!!!

07-11-2005, 08:53 PM
View their source then. My code included a test, written in red, that I didn't know how to perform. I said in my message:

Still, we need to have a way of determining if the xml doc has changed (represented as red in the above code). If you have a way of doing that, it could work out well.Did you take care of that?