Click to See Complete Forum and Search --> : WMP playlist seems to be caching


jonesin
06-06-2008, 03:43 PM
Hi,

I've got a problem using a playlist to display my videos. I think it may be caching? I'm building the playlist on the fly but each time the page is called, it randomizes the play order. When I refresh the page, I can see that it does indeed get randomized when viewing it on the server. But, when the it plays on my website, it doesn't get updated. It only gets updated if I close the browser and re-open it. Any ideas? Below is my code.

Kind regards,
J

//delete the existing playlist
unlink('videos/Adverts/Adverts.wvx');

//Get the contents of the directory.
$sDirHandle = dir("videos/Adverts");
$iCounter = 0;
while (false !== ($sFile = $sDirHandle->read()))
{
if ($sFile != '.' && $sFile != '..' && $sFile != 'Adverts.wvx')
{
$sAdvertArray['NoSessionVids'][$iCounter] = $sFile;
$iCounter ++;
}
}

//Randomize the array order
shuffle($sAdvertArray['NoSessionVids']);

//Create a playlist for the adverts.
list($uSec, $iSec) = explode(" ", microtime());
$sTimeStamp = (float)$uSec + (float)$iSec;
$sPlaylist = 'videos/Adverts/' . $sTimeStamp . '.wvx';

$fPointer = fopen('videos/Adverts/Adverts.wvx', 'w');
fwrite($fPointer, "<ASX version = \"3.0\">\r\n");

for ($iCount = 0; $iCount < $iCounter; $iCount ++)
{
fwrite($fPointer, "<Entry>\r\n");
fwrite($fPointer, "<Ref href=\"" . $sAdvertArray['NoSessionVids'][$iCount] . "\" />\r\n");
fwrite($fPointer, "</Entry>\r\n");
}
fwrite($fPointer, "</ASX>\r\n");
fclose($fPointer);

//Play videos
print '<OBJECT id="VIDEO" width="400" height="225" ';
print 'style="position:absolute; center:50px;top:51px;"';
print 'CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"';
print 'type="application/x-oleobject">';

print '<PARAM NAME="URL" VALUE="videos/Adverts/Adverts.wvx"> ';
print '<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">';
print '<PARAM NAME="AutoStart" VALUE="true">';
print '<PARAM name="uiMode" value="none">';
print '<PARAM name="PlayCount" value="1">';
print '<embed src="videos/Adverts/Adverts.wvx" width="400" height="225" hspace="0" vspace="0" autostart="true" filename="videos/Adverts/Adverts.wvx" playcount="1"></embed>';
print '</OBJECT>';