looping an audio file

Discussion in 'Javascript' started by Ivo, Dec 13, 2004.

  1. Ivo

    Ivo Guest

    I have an audio file (.mid or .wav or .mp3) in an object element:

    <object id="snd" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
    cab#Version=5,1,52,701" type="application/x-oleobject" width="282"
    <param name="FileName" value="Tjaikovsky_-_The_sorcerers_apprentice.mid" />
    <param name="loop" value="true" />
    <... more presentational params ...>
    <embed name="embsnd" src="Tjaikovsky_-_The_sorcerers_apprentice.mid"
    width="280" height="53" controls="smallconsole" autostart="true"

    and a checkbox with which I would like to toggle the looping behaviour of
    said object:

    <label for="chloop">Loop:</label><input type="checkbox" id="chloop"
    onclick="toggleloop(this);" class="zm" checked>

    However, the sound keeps looping whatever I put in the toggle function:

    function toggleloop(el){

    Resources on the web speak of embedding sounds into webpages in many ways,
    but none I have found that discuss this particular issue. I hope someone
    spots my error.
    Ivo, Dec 13, 2004
    1. Advertisements

  2. Ivo

    Ivo Guest

    Thanks for your thoughts. The 'solution' I now have does that more or less:
    there are two of those objects, one set to loop and visible, the other
    non-looping and invisible. I toggle which sound is visible and hearable with
    the checkbox.

    But it 's not a solution at all: the whole idea behind this application is
    that users can toggle the looping behaviour *while the sound is playing*,
    and that it *keeps playing* at least till the end of the current round!
    Obviously, with your suggestion and my solution, the moment the checkbox is
    clicked, the current sound stops and the other one starts playing. And
    detecting with javascript when a sound file reaches the end also seems

    I was hoping the same thing, I started with just an embed tag, then added
    the object hoping it would listen to my script, but alas!
    Ivo, Dec 15, 2004
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.