How to Play a series of .mid files as background

Discussion in 'Javascript' started by Jack Sirulnikoff, Mar 3, 2004.

  1. Hi,

    I'm trying to write some javascript to set up a series of MIDI files as
    background using <EMBED>. I can get it to work in general, but the main
    problem I have is:

    what coding can be used so that each subsequent selection only starts when
    the previous selection has finished.

    an additional problem will be:

    how to clear the control panel from the display after the selection has
    finished.

    The coding I'm trying to use is something like this in the <BODY>:

    <SCRIPT>
    var soundFile = "jsrgo1gm.mid,jsrgo2gm.mid,jsrgo3gm.mid";

    for (var counter = 0; counter < 3; counter++) {
    // something in here to determine when the next piece can start, and to
    clear the Console
    var sounds = soundFile.split(",");soundFile = sounds[counter];
    document.write('<embed src="'+soundFile+'" autostart="true"
    controls="Console" width=144 height=60></embed>');
    }
    </SCRIPT>

    <noscript><embed src="jsrgo1gm.mid" autostart="true" ></embed></noscript>
    <noembed><bgsound src="jsrgo1gm.mid" ></noembed>

    I would appreciate any help you can provide, and if there is an altogether
    better way of doing this, I would appreciate hearing about that as well.

    Thanks,

    Jack
     
    Jack Sirulnikoff, Mar 3, 2004
    #1
    1. Advertising

  2. Jack Sirulnikoff

    Randy Webb Guest

    Jack Sirulnikoff wrote:
    > Hi,
    >
    > I'm trying to write some javascript to set up a series of MIDI files as
    > background using <EMBED>. I can get it to work in general, but the main
    > problem I have is:
    >
    > what coding can be used so that each subsequent selection only starts when
    > the previous selection has finished.
    >
    > an additional problem will be:
    >
    > how to clear the control panel from the display after the selection has
    > finished.
    >
    > The coding I'm trying to use is something like this in the <BODY>:
    >
    > <SCRIPT>
    > var soundFile = "jsrgo1gm.mid,jsrgo2gm.mid,jsrgo3gm.mid";
    >
    > for (var counter = 0; counter < 3; counter++) {
    > // something in here to determine when the next piece can start, and to
    > clear the Console
    > var sounds = soundFile.split(",");soundFile = sounds[counter];
    > document.write('<embed src="'+soundFile+'" autostart="true"
    > controls="Console" width=144 height=60></embed>');
    > }
    > </SCRIPT>
    >
    > <noscript><embed src="jsrgo1gm.mid" autostart="true" ></embed></noscript>
    > <noembed><bgsound src="jsrgo1gm.mid" ></noembed>
    >
    > I would appreciate any help you can provide, and if there is an altogether
    > better way of doing this, I would appreciate hearing about that as well.
    >



    Embed an .m3u file and let the default application handle it. An .m3u
    file is nothing more than a "playlist" of files. The URLs in an .m3u
    file *must* be absolute URLs.


    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Randy Webb, Mar 3, 2004
    #2
    1. Advertising

  3. Thanks for your help. I set up an .m3u, and it worked perfectly from the
    test directory on my hard drive. Since all my files are in one directory, it
    worked both with just the filename, and using the absolute URL. However,
    neither way worked when I tried to run it from my website. I suspect the
    problem still has to do with that, but I'm not sure what the answer is.

    Jack

    "Randy Webb" <> wrote in message
    news:...
    > Jack Sirulnikoff wrote:
    > > Hi,
    > >
    > > I'm trying to write some javascript to set up a series of MIDI files as
    > > background using <EMBED>. I can get it to work in general, but the main
    > > problem I have is:
    > >
    > > what coding can be used so that each subsequent selection only starts

    when
    > > the previous selection has finished.
    > >
    > > an additional problem will be:
    > >
    > > how to clear the control panel from the display after the selection has
    > > finished.
    > >
    > > The coding I'm trying to use is something like this in the <BODY>:
    > >
    > > <SCRIPT>
    > > var soundFile = "jsrgo1gm.mid,jsrgo2gm.mid,jsrgo3gm.mid";
    > >
    > > for (var counter = 0; counter < 3; counter++) {
    > > // something in here to determine when the next piece can start, and to
    > > clear the Console
    > > var sounds = soundFile.split(",");soundFile = sounds[counter];
    > > document.write('<embed src="'+soundFile+'" autostart="true"
    > > controls="Console" width=144 height=60></embed>');
    > > }
    > > </SCRIPT>
    > >
    > > <noscript><embed src="jsrgo1gm.mid" autostart="true"

    ></embed></noscript>
    > > <noembed><bgsound src="jsrgo1gm.mid" ></noembed>
    > >
    > > I would appreciate any help you can provide, and if there is an

    altogether
    > > better way of doing this, I would appreciate hearing about that as well.
    > >

    >
    >
    > Embed an .m3u file and let the default application handle it. An .m3u
    > file is nothing more than a "playlist" of files. The URLs in an .m3u
    > file *must* be absolute URLs.
    >
    >
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Jack Sirulnikoff, Mar 4, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lola
    Replies:
    34
    Views:
    14,502
    Oldmancolorado_deleted
    Jun 16, 2010
  2. rock826
    Replies:
    0
    Views:
    326
    rock826
    Oct 8, 2007
  3. rock826

    Nice small game to play at work - Series 1

    rock826, Oct 8, 2007, in forum: C Programming
    Replies:
    0
    Views:
    652
    rock826
    Oct 8, 2007
  4. Replies:
    4
    Views:
    1,010
    James Kanze
    May 9, 2008
  5. Replies:
    7
    Views:
    1,199
    James Kanze
    May 9, 2008
Loading...

Share This Page