PDA

View Full Version : music on/off switch?



Kirl
Sep 10th, 2007, 09:19 PM
How can I switch off a midi file?

I want to make a very basic sound on/off switch for a single midi file. I can manage to play the sound but how to stop?

Philip M
Sep 10th, 2007, 10:27 PM
<p align="right"><font face="Arial" size="1"><a href="javascript:document.embeds['musicfile'].stop()">Stop Music</a></p>

<EMBED src="stiekemgedanst.mid" name="musicfile" volume="-800" autostart="true" hidden="true">

Kirl
Sep 11th, 2007, 12:34 AM
Lol, that is the title of a dutch song, was that on purpose?

I can't get it to work in any of the browsers though, I played around with it but alas... :(

Any reason the volume was set to -800?

Philip M
Sep 11th, 2007, 09:07 AM
Lol, that is the title of a dutch song, was that on purpose?

I can't get it to work in any of the browsers though, I played around with it but alas... :(

Any reason the volume was set to -800?

Jazeker, al ben ik Englesman spreek ik aardig Nederlands. Vroeger was ik docent bij Stichting De Baak in Noordwijk.

It works fine for me in IE.

The volume was set to -800 as the recording is rather loud. Possibly your own music is not audible at -800 - simply delete volume="-800".

Kirl
Sep 14th, 2007, 03:38 PM
Hey, that's cool! Small world afterall :)


Sorry for the late reply, I was away for the week and only now had a chance to post.

Unfortunatly it's still not working for me, not even in IE so I must be doing something wrong altogether. The music is playing, but it doesn't stop, I pasted everything between the body tags below.



<a href='javascript:document.embeds["musicfile"].stop()'>Stop Music</a>

<EMBED src="musica.mid" name="musicfile" autostart="true" hidden="true">


FF's error concole says: document.embeds.musicfile.stop is not a function?

Philip M
Sep 14th, 2007, 05:10 PM
Well, I use it on many pages in my website. It certainly works in IE.

For a demo go to http://www.ogauge.co.uk/carrs.html

(Edit) I have now tested it in Opera but it does not work, so looks as though IE only.

Kirl
Sep 16th, 2007, 12:56 PM
Hmm, the demo page doesn't seem to work for me in IE7.0.5 either, no music starts. I'm looking for a crossbrowser solution though, so even if IE would've worked for me, I can't use it. :(

If there are any other (cross-broser) solutions, I'm very interested.

Philip M
Sep 16th, 2007, 02:22 PM
Kirl - I am so sorry! I forgot to upload the .mid file (deversonkenstad.mid) to the server! :o :o :o

Try it again - it is definitely working in IE. But it seems not to work in Opera and I am not sure about Firefox.