cifkao / html-midi-player

🎹 Play and display MIDI files on the web
https://cifkao.github.io/html-midi-player/
BSD 2-Clause "Simplified" License
683 stars 62 forks source link

Can we follow HTMLMediaElement interface for `midi-player` HTMLElement? #65

Open leo6104 opened 1 year ago

leo6104 commented 1 year ago

Currently, it declare start() for playing the midi file.

In HTMLMediaElement, its interface for playing audio is play().

It would be great to follow same interface as HTMLMediaElement Instance Methods. https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play

Instance property

Instance Property (special for midi-player)

Instance Methods

Events

Special Events for midi-player

leo6104 commented 1 year ago

@muxinc/elements can be helpful for implementing all events / properties / methods.

https://github.com/muxinc/elements

They provide great compatibility with HTMLMediaElement with clean code.

If you allow me to modify its interface to be like HTMLMediaElement, i can take my efforts on here and can make PR for this.

cifkao commented 1 year ago

This is interesting, but if it requires some big changes, I would need to understand if and why it's really worth it.

We can of course add play() as an alias of start(), but I would like to avoid any breaking changes (such as removing start() or making controls disabled by default).

I'm probably not so much in favor of complete support for the whole HTMLMediaElement API, since we cannot really implement it properly anyway, at least with Magenta.js as a backend – for example, we cannot get timeupdate working nicely I think.