About embed midi files on a webpage

后端 未结 7 984
失恋的感觉
失恋的感觉 2021-02-13 19:18

I am working on a project related to vintage web designs. I would like to embed and autoplay a midi file but:

  1. It doesen\'t work on IOS (I tried with my ipad)
相关标签:
7条回答
  • 2021-02-13 19:42

    Your HTML is OK. The problem is that some lower class browsers have lost the ability to play midi files. They have to install an add on. Real Player used to be a good solution, but now they are pushing a cloud subscription. There are plenty of other midi players around, but the users have to install one.

    0 讨论(0)
  • 2021-02-13 19:43

    Browsers dropped support for playing MIDI files natively over time. You might want to try MIDI.js, a JavaScript based cross browser library.

    Add the MIDI.js script to your webpage:

        <script type='text/javascript' src='http://www.midijs.net/lib/midi.js'></script>
    

    And then add a link to start playing:

        <a href="#" onClick="MIDIjs.play('path/to/yoursong.midi');">Play My Song</a>
    

    Take a look at http://www.midijs.net for details.

    0 讨论(0)
  • 2021-02-13 19:48

    Well, here it is Aug 13, 2017 and don't you know embedding a bg midi on a web page is still a mystery.

    In fact I'm pretty certain it can't even be done anymore (except IE's bgsound src, which still works fine for me).

    But as for Firefox and Chrome, the solution provided by jofeu is a great work-around.

    I only wish there was a way to embed so the midi just starts playing on page load, without having to click anything. I guess those days are gone.

    0 讨论(0)
  • 2021-02-13 19:50

    For mid, and kar files, I suggest using vanBasco midi player as your default player. See the source on http://midkar.com/blues/blues_01.html

    To Embed; embed src="musicfile.mid" width=144 height=60 autostart=true repeat=false loop=false (replace the "musicfile.mid" with the name of your midi file)

    0 讨论(0)
  • 2021-02-13 19:56

    Use the HTML5 Audio tag. But like The guy before me said.... please reconsider music on your page.

    <audio src="example.midi" preload="auto" autoplay="autoplay"></audio>
    
    0 讨论(0)
  • 2021-02-13 19:59

    Yes, the embed tag is reserved for plugins, which Mobile Safari doesn't support.

    Take a look at HTML5 audio tag, which is supported by most browsers.

    But please don't play music on a webpage... it's annoying - most either listens to music, have the speakers turned off, or are at the office.

    0 讨论(0)
提交回复
热议问题