Results 1 to 7 of 7

Thread: DOM XMLTicker: Refresh advice please

  1. #1
    Join Date
    Jul 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DOM XMLTicker: Refresh advice please

    Hi

    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!

    Cheers
    Kevin

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I must have caught it at an odd time or you are mistaken, the contents of the file remained as:
    Code:
      <?xml version="1.0" ?> 
    - <xmlticker>
      <pause>3000</pause> 
    - <message>
    - <![CDATA[ Kevin Coy
      ]]> 
      </message>
    - <message>
    - <![CDATA[ 
      ]]> 
      </message>
      <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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well then, this looks suspect:
    Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!---
     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:
    Code:
    '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:

    Code:
     var refreshID = "";
     refreshID = setInterval("DoRefresh()", 500);
     
    function DoRefresh(){
    if xmlsource not different
    return;
      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"){
    xmlDoc.load(xmlsource)
    }
      fetchxml()
    }
    just after this line:
    Code:
    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jul 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

    Help!!!!!!!

  6. #6
    Join Date
    Jul 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    on another note, i notice that www.passionradio.co.uk have managed it somehow!!!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:
    Quote Originally Posted by me
    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?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •