How To Preload A MIDI

  • Thread starter X l e c t r i c
  • Start date
X

X l e c t r i c

I've tried this:

var bg_sound = new Object();
bg_sound.src = "thesong.mid";

and this (which is probably improper but strangely enough it works for
WebTV):

var bg_sound = new Image();
bg_sound.src = "thesong.mid";

both didn't work for PC (IE6).

During a search I saw this suggested:

document.write('<embed src="thesong.mid" autostart="false" hidden="true"
loop="0"></embed>');

(I added the </embed>, is it necessary ?)

Is there a way to preload a MIDI ?

Later, Art.
 
V

VK

X said:
I've tried this:

var bg_sound = new Object();
bg_sound.src = "thesong.mid";

and this (which is probably improper but strangely enough it works for
WebTV):

var bg_sound = new Image();
bg_sound.src = "thesong.mid";

both didn't work for PC (IE6).

During a search I saw this suggested:

document.write('<embed src="thesong.mid" autostart="false" hidden="true"
loop="0"></embed>');

(I added the </embed>, is it necessary ?)

Is there a way to preload a MIDI ?

Later, Art.


Did not use it for years, so right out of my head:

.... in your HTML code ...

<!--[if IE]>
<bgsound id="IEPlayer" src="empty.mid">
<![endif]-->
<![if !IE]>
<embed name="NNPlayer src="thesong.mid" autostart="false"
hidden="true" mastersound></embed>
<![endif]>

.... in your script:
....
function playMusic() {
if(document.getElementById('IEPlayer')) {
myPlayer = document.getElementById('IEPlayer');
myPlayer.src = 'Circus.mid';
}
else {
myPlayer = document.embeds['NNPlayer'];
//myPlayer.play(); or so: play() did not work
// either broken or I forgotten the mastersound command
// respectivele to stop playing you use stop() or so for NN
// and simply IEPlayer.src = ''
}
}
window.onload=playMusic;
....
 
X

X l e c t r i c

Thanks VK.

I appreciate your reply. I'll try it out and see what happens.

Later, Art.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,796
Messages
2,569,645
Members
45,371
Latest member
TroyHursey

Latest Threads

Top