Forum Moderators: not2easy

Message Too Old, No Replies

PHP: Creating Windows Media Player Playlist (ASX)

         

ladams02

11:02 pm on Apr 3, 2005 (gmt 0)

10+ Year Member



I am creating a Text-To-Speech engine for one of my classes and I've ran into a brick wall. I finally got the PHP code working along with the database, but for some reason I am having trouble editing the ASX file, it is playing the same wav file no matter which one I tell it to play. I've deleted the ASX file a couple times, and after a few minutes it will let me say a new word, but then again it will get locked on that one word.

The only thing I can post is the section of code I'm having trouble with.

Thanks for any help.


if ($allMatch == 1)
{
$fp = fopen("play.asx", "w+");
fwrite($fp, "<ASX version = 3.0>");
fclose($fp);
$n = 0;

for($dbCount=0; $dbCount < $formCount; $dbCount++)
{

$connection = odbc_connect("USER","PASS","");
$sql = "select * from pokerTTS where Text = '$tts[$n]'";
$sql_result = odbc_exec($connection, $sql);

$location = odbc_result($sql_result, 'Address');
//$word = odbc_result($sql_result, 'Text');

echo $location;
echo "<br>";

$fp = fopen("play.asx", "a");
fputs($fp, "<Entry><Ref href = \"$location\" /></Entry>");
fclose($fp);

$n = $n + 1;
}

$fp = fopen("play.asx", "a");
fputs($fp, "</ASX>");
fclose($fp);

?> <div align="center"> <OBJECT ID="mediaPlayer" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
STANDBY="Loading Microsoft Windows Media Player components..."
TYPE="application/x-oleobject">
<PARAM NAME="fileName" VALUE="play.asx">
<PARAM NAME="animationatStart" VALUE="true">
<PARAM NAME="transparentatStart" VALUE="true">
<PARAM NAME="autoStart" VALUE="true">
<PARAM NAME="showControls" VALUE="true">
</OBJECT> </div> <?
}

[edited by: tedster at 12:08 am (utc) on April 4, 2005]

ladams02

7:33 am on Apr 4, 2005 (gmt 0)

10+ Year Member



I figured out to create a filename off the time, and then have it play that filename. I will have to delete the files off every once in a while, but this will satisfy the requirements of my assignment.