Hey, I use a display screen on an HTPC to display media information for winamp with the plug-in browseamp. I'm in the process of building a control interface, but I'm running into some difficulty with the javascript. I'm attempting to have the song position and time remaining called and displayed in text without the need to refresh the page. So far I have:
which updates the length of the progress bar. I'm trying to call:Code:function UpdateTime() { if(SecondsRemain > 0) { SecondsRemain--; TrackPos++; } else if (Status=="play") { window.setTimeout("sendCommand('refresh')",1000); parent.window.setTimeout("refreshPlaylist() ",1000); } document.getElementById("progressBar").width = Math.max(1,TrackPos/TotalSeconds*document.getElementById("progressBarCell").width-4) ; //alert(SecondsRemain,TrackPos); if (Status=="play") window.setTimeout("UpdateTime()",1000); }
and have the position and song time remaining updated in real-time in text. I'm pretty new to javascript, so let me know if there is additional information from the code needed. Appreciate it!Code:<div id="timers"> <table border="0" cellpadding="0" cellspacing="0" width="524"> <tr> <td id="TotalSeconds"><#SongLengthMin>:<#SongLengthSec></td> <td id="TrackPos"><#SongPositionMin>:<#SongPositionSec></td> <td id="SecondsRemain">-<#SongRemainMin>:<#SongRemainSec></td> </tr> </table> </div>


Reply With Quote
Bookmarks