Advertisement
C_Volume2 Miscellaneous #80603

Control MIDI or WAV file using Javascript

How can you control midi or wav files using JavaScript?You should use the EMBED tag. Found at http://www.irt.org

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
The following will play the midi or wav file as soon as its loaded: 
<HTML>
<BODY>
<EMBED SRC="sound.wav" HIDDEN=TRUE>
</BODY>
</HTML>
 

The following allows you control when it plays: 
<HTML>
<BODY>
<SCRIPT LANGUAGE="JavaScript"><!--
function playSound() { document.firstSound.play(false); }
function pauseSound() { document.firstSound.pause(); }
function stopSound() { document.firstSound.stop(); }
//--></SCRIPT>
<A HREF="javascript:playSound()">Play the sound now!</A><BR>
<A HREF="javascript:pauseSound()">Pause/Restart the sound</A><BR>
<A HREF="javascript:stopSound()">Stop the sound</A><BR>
<EMBED SRC="sound.wav" HIDDEN=TRUE AUTOSTART=FALSE LOOP=FALSE NAME="firstSound" MASTERSOUND>
</BODY>
</HTML>
 
You can replace sound.wav with sound.mid. 

Upload
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine