Problem with Function to play midi files
Posted: Tue Jul 13, 2010 11:26 pm
Well: in my Asp Web site for a long time I use this function to play a Midi file when the user click in the name of the Midi.This is line:
<A href="javascript:void(null)" onclick="tocar('http://www.prolatin.com/musica/' + '<%=rs.fields("ARCHIVO")%>',1,280,67)"><%= response.write(x.value) %></A>
This is the function:
function mp3(nombre,rpt,width,height){
CodeGen = ""
var mediaURL,rpt,width,height
nueva = window.open ("", "Crescendo", "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizeable=no,copyhistory=no,width=300,height=300,top=120,left=0")
nueva.document.open()
nueva.document.write("<html><head><title>" + "Música original de Jorge Villamizar" + "</title>")
nueva.document.write("<center>")
nueva.document.write("<body bgcolor='#669999' text='#000000'></body>")
nueva.document.write("<table border='0' align='center'>")
nueva.document.write("<tr>")
nueva.document.write("<td valign='middle' align='center' bgcolor='oldlace' ")
CodeGen = '<object id=Player' + '\n' ;
CodeGen += 'codeBase=http://activex.microsoft.com/activex/co ... 6,0,02,902' + '\n' ;
CodeGen += 'type=application/x-oleobject height=' + height + ' width=' + width + '\n' ;
CodeGen += ' standby="Loading Microsoft® Windows® Media Player components..." ' + '\n' ;
CodeGen += 'classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"> ' + '\n' ;
CodeGen += '<param NAME="Filename" VALUE="' + nombre + '">' + '\n' ;
CodeGen += '<param NAME="ShowStatusBar" VALUE= "true">';
CodeGen += '<param NAME="autoStart" VALUE="true"><param NAME="Volume" VALUE="0">' + '\n' ;
CodeGen += '<param NAME="playCount" VALUE=' + rpt + '></object>'
nueva.document.write("</td>")
nueva.document.write("</tr>")
nueva.document.write("</table>")
nueva.document.write("</center>")
nueva.document.write(CodeGen)
nueva.document.close()
}
Working OK but in ASP!!!
But I change all my ASP sites to PHP. In PHP I use this line:
Don´t work. No error but not sound. ARCHIVO is the name of Midi file. Previous I convert this name to lower case like because in the MUSICA directory in my hosting server the midi names they are in lowercase. (In asp there is not difference among lower or upper case but in PHP I have many problems because I forget this.)
If somebody wants to verify what happens, this is the url:
http://sml.prolatin.com/to.php
The site is not still finished. Simply, click in the name of the song.
If somebody know how I can configure this function to work in PHP or if know a better system to play these Midi Files, I will appreciate your help a lot. Thx for you help. Very important to me.
<A href="javascript:void(null)" onclick="tocar('http://www.prolatin.com/musica/' + '<%=rs.fields("ARCHIVO")%>',1,280,67)"><%= response.write(x.value) %></A>
This is the function:
function mp3(nombre,rpt,width,height){
CodeGen = ""
var mediaURL,rpt,width,height
nueva = window.open ("", "Crescendo", "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizeable=no,copyhistory=no,width=300,height=300,top=120,left=0")
nueva.document.open()
nueva.document.write("<html><head><title>" + "Música original de Jorge Villamizar" + "</title>")
nueva.document.write("<center>")
nueva.document.write("<body bgcolor='#669999' text='#000000'></body>")
nueva.document.write("<table border='0' align='center'>")
nueva.document.write("<tr>")
nueva.document.write("<td valign='middle' align='center' bgcolor='oldlace' ")
CodeGen = '<object id=Player' + '\n' ;
CodeGen += 'codeBase=http://activex.microsoft.com/activex/co ... 6,0,02,902' + '\n' ;
CodeGen += 'type=application/x-oleobject height=' + height + ' width=' + width + '\n' ;
CodeGen += ' standby="Loading Microsoft® Windows® Media Player components..." ' + '\n' ;
CodeGen += 'classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"> ' + '\n' ;
CodeGen += '<param NAME="Filename" VALUE="' + nombre + '">' + '\n' ;
CodeGen += '<param NAME="ShowStatusBar" VALUE= "true">';
CodeGen += '<param NAME="autoStart" VALUE="true"><param NAME="Volume" VALUE="0">' + '\n' ;
CodeGen += '<param NAME="playCount" VALUE=' + rpt + '></object>'
nueva.document.write("</td>")
nueva.document.write("</tr>")
nueva.document.write("</table>")
nueva.document.write("</center>")
nueva.document.write(CodeGen)
nueva.document.close()
}
Working OK but in ASP!!!
But I change all my ASP sites to PHP. In PHP I use this line:
Code: Select all
<a href="javascript:void(null)" onclick="tocar('http://www.prolatin.com/musica/<?php echo $row["ARCHIVO"];?>,1,280,67')"><?php echo $row["TEMA"]; ?></a>If somebody wants to verify what happens, this is the url:
http://sml.prolatin.com/to.php
The site is not still finished. Simply, click in the name of the song.
If somebody know how I can configure this function to work in PHP or if know a better system to play these Midi Files, I will appreciate your help a lot. Thx for you help. Very important to me.