yvesgurcan/web-midi-player

Audit browser compatibility

Closed this issue · 6 comments

Audit browser compatibility

Hello! I'm using your library, thank you very much for maintaining it!

I'm using version 1.1.19. I use the following code to play MIDI files by URL:

midiPlayer = new MidiPlayer();
await this.midiPlayer.stop();
midiPlayer.play({ url: baseUrl + url })

It works perfectly in the latest versions of desktop Chrome and Firefox but doesn't work in Safari both on Mac and iPhone.

On iPhone, I cannot check the error. Here is the error in Safari on Mac:

[Error] Unhandled Promise Rejection: ReferenceError: Can't find variable: AudioContext
	(anonymous function) (main.chunk.js:1426)
	asyncFunctionResume
	(anonymous function)
	promiseReactionJob

This error happens on line midiPlayer.play({ url: baseUrl + url }).

Thank you, @Ksinia! I've opened an issue (#136) for Safari/WebKit and also started a pull request (#137). Unfortunately, it looks like supporting these browsers will take a little bit more elbow grease. Web MIDI Player relies on AudioContext and the WebKit implementation of it is still experimental and broken. I was able to get rid of the error you mentioned above but there are issues triggering the actual playback :(

It looks like the browsers that don't support Web MIDI Player are Internet Explorer and Safari.

@Ksinia Great news! I've fixed the issue with Safari. Web MIDI Player version 1.3.0 should now work in this browser :)

@yvesgurcan Thanks, it works!

Woohoo! 🎉 How's the memory usage?