I am posting below what currently happens on the result page, depending on which browser is used. If you tell me whether you used IE or Firefox, and which media player, we should be able to pinpoint the Javascript function that caused the problem, and maybe we can come up with something that works better. I already try to keep the players from starting on their own, but either I am doing something wrong or the browsers or media players just ignore that.
Here's the current code (the function playMedia is called for every matching MIDI file). It is already a few years old, so some adjusting to current browsers and media players might be a very good idea.
function playMedia(mediaURL,height,width,from,to) {
var mediaURL,height,width;
if (GetBrowser() == "Netscape")
embedMPlayer(mediaURL,height,width);
if (GetBrowser() == "IE")
embedIEobject(mediaURL,height,width);
if (navigator.appName.substring(0,5) == "WebTV")
embedSource(mediaURL,height,width);
}
function embedSource(mediaURL,height,width,from,to) {
var CodeGen = "";
var mediaURL,height,width;
CodeGen = '<embed src="' + mediaURL + '"' + '\n' ;
CodeGen += ' height=' + height + ' width=' + width + 'autostart="false" starttime="' + from+ '" ENDTIME="'+to+'" \n';
CodeGen += ' LOOP="false"' + //rpt +
'>';
document.write(CodeGen);
}
function embedMPlayer(mediaURL,height,width) {
CodeGen = "";
var mediaURL,height,width;
CodeGen = '<embed type="application/x-mplayer2" ' + '\n' ;
// http://www.microsoft.com/Windows/MediaPlayer/
CodeGen = CodeGen + 'pluginspage="http://www.apple.com/quicktime/download/" ' + '\n' ;
CodeGen = CodeGen + 'Name="MediaPlayer" ' + 'src="' + mediaURL + '" '
+ '\n' ;
CodeGen = CodeGen + 'autoStart=0 ' ;
if ((height == 24) && (width == 299))
CodeGen = CodeGen + 'ShowStatusBar=1 ';
if ((height >= 50) && (width >= 200))
CodeGen = CodeGen + 'ShowStatusBar=1 ';
if ((height <= 49) && (width != 299))
CodeGen = CodeGen + 'ShowStatusBar=0 ';
CodeGen = CodeGen + 'playCount=1' + ' ' ;
CodeGen = CodeGen + 'volume=-1 ' ;
CodeGen = CodeGen + 'HEIGHT=20' + ' WIDTH=' + width + '>'
document.write(CodeGen)
}
function embedIEobject(mediaURL,height,width){
CodeGen = ""
var mediaURL,height,width
CodeGen = '<object id=Player' + '\n' ;
CodeGen +=
'codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=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="' + mediaURL + '">' + '\n' ;
if ((height == 24) && (width == 299))
CodeGen += '<param NAME="ShowStatusBar" VALUE= "true">';
if ((height >= 50) && (width >= 200))
CodeGen += '<param NAME="ShowStatusBar" VALUE= "true">';
if ((height <= 49) && (width != 299))
CodeGen += '<param NAME="ShowStatusBar" VALUE= "false"> ';
CodeGen += '<param NAME="autoStart" VALUE="false"><param NAME="Volume" VALUE="-1">' + '\n' ;
CodeGen += '<param NAME="playCount" VALUE=1' + '></object>'
document.write(CodeGen);
}