Make sure your mark-up works with a file before trying it with your script. I had no problems getting a script to work with this mark-up:
<object id="MediaPlayer" width=320 height=286
classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
standby="Loading
Windows Media Player components..." type="application/x-oleobject"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/n
+smp2inf.cab#Version=6,4,7,1112">
<param name="filename" value="/cgi-bin/playwmv">
<param name="Showcontrols" value="True">
<param name="autoStart" value="True">
<embed type="application/x-mplayer2"
src="/cgi-bin/playwmv" name="MediaPlayer" width=320 height=240>
</embed>
</object>