Results 1 to 4 of 4

Thread: Embedding MIDI Files in a web page

  1. #1
    Bronze Member carloc's Avatar
    Join Date
    Sep 2004
    Location
    Italy
    Posts
    166

    Embedding MIDI Files in a web page

    What's the correct tag for embedding a MIDI song in a web page?

    Code:
    <bgsound src="http://www.myurl.com/sound.mid" loop=N">
    (where N is the number of loops, -1 for an infinite loop)

    or
    Code:
    <embed src="http://www.myurl.com/sound.mid">
    Is this sintax HTML standard compliant or does it work only with IE?

    And how can I turn the sound ON/OFF with a mouse click?
    Last edited by carloc; December 5th, 2005 at 10:19 AM.

  2. #2
    Triple Platinum Member
    Join Date
    Aug 2004
    Posts
    883
    I learnt from here that there is no major difference except that the <bgsound> tag should be included in the <background> tag.

    The output will vary in each case though. The <bgsound> tag will cause the file to be played in the background whereas the <embed> tag will make the midi file appear as an object on the page- thereby enabling the user to turn on/turn off the music as he wishes.

    More info here.
    Last edited by rohitk89; December 6th, 2005 at 09:54 AM.

  3. #3
    Head Honcho Administrator Reverend's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    14,044
    Continuous play:

    Code:
    <EMBED src="http://www.myurl.com/sound.mid" autostart=true loop=true volume=100 hidden=true><NOEMBED><BGSOUND src="http://www.myurl.com/sound.mid"></NOEMBED>
    Play once:

    Code:
    <EMBED src="http://www.myurl.com/sound.mid" autostart=true loop=false volume=100 hidden=true><NOEMBED><BGSOUND src="http://www.myurl.com/sound.mid"></NOEMBED>

    =========== Please Read The Forum Rules ===========

  4. #4
    Bronze Member carloc's Avatar
    Join Date
    Sep 2004
    Location
    Italy
    Posts
    166
    Thank you guys!
    Currently I'm testing this solution:
    Code:
    <SCRIPT TYPE="text/javascript">
    <!-- 
    var filename="Jingle bells.mid";
    if (navigator.appName == "Microsoft Internet Explorer")
        document.writeln ('<BGSOUND SRC="' + filename + '">');
    else if (navigator.appName == "Netscape")
        document.writeln ('<EMBED SRC="' + filename + '" AUTOSTART=TRUE WIDTH=150 HEIGHT=20>');
    // -->
    </SCRIPT>
    <NOSCRIPT>
    <BGSOUND SRC="Jingle bells.mid">
    </NOSCRIPT>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •