surikov / webaudiofont

Use full GM set of musical instruments to play MIDI and single sounds or effects. Support for reverberation and equaliser. No plugins, no Flash. Pure HTML5 implementation compatible with desktop and mobile browser. See live examples.
https://surikov.github.io/webaudiofont/
GNU General Public License v3.0
882 stars 92 forks source link

Midi File not Playing in Background #106

Closed bakoorjakkals closed 3 months ago

bakoorjakkals commented 3 months ago

Describe the bug Good day, thanks for this wonderful library.

I'm trying add the capability to play MIDI files to my webapp. I have implemented a working solution based off your example: https://surikov.github.io/webaudiofont/examples/midiplayer.html.

However, when I change browser tabs or applications, the MIDI file stops playing. This is the case both inside my webapp and in the example. Is there a way to configure webaudiofont so that MIDI files can continue to play in the background?

To Reproduce Steps to reproduce the behavior:

  1. Go to https://surikov.github.io/webaudiofont/examples/midiplayer.html
  2. Play a MIDI file
  3. Change to a different tab
  4. MIDI stops playing

Desktop (please complete the following information):

surikov commented 3 months ago

Webaudiofont does not play MIDI files. Webaudiofont plays musical instruments.

This page is an old quick example of using Webaudiofont: https://surikov.github.io/webaudiofont/examples/midiplayer.html

There are no plans to change the examples.

Hint The browser does not allow window.requestAnimationFrame to be used on background tabs. You need to change it for your own applications.

bakoorjakkals commented 3 months ago

Thanks for the hint, I will see if I can get it to work.

page200 commented 3 weeks ago

An approach that works but hasn't yet been optimized was discussed in issue #92. Please let us know in case you optimize it.