Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
6 of 41 tasks
leo6104 opened this issue May 31, 2023 · 2 comments
Open
6 of 41 tasks

Comments

@leo6104
Copy link

leo6104 commented May 31, 2023

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

  • autoplay
  • buffered
  • controls: boolean
  • currentTime
  • currentSrc
  • defaultMuted: boolean
  • duration
  • ended
  • error
  • loop
  • muted
  • paused
  • playbackRate
  • preservesPitch
  • readyState
  • seekable
  • seekId

Instance Property (special for midi-player)

  • seeking
  • playing

Instance Methods

  • play() - rename start() to play()
  • stop()
  • pause()
  • canPlayType()
  • load()
  • fastSeek()

Events

  • canplay
  • play - rename start to play
  • playing
  • pause
  • timeupdate
  • error
  • ended
  • abort
  • durationchange
  • loadstart
  • loadeddata
  • volumechange
  • suspend
  • seeking
  • seeked

Special Events for midi-player

  • note
@leo6104
Copy link
Author

leo6104 commented May 31, 2023

@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
Copy link
Owner

cifkao commented Jun 22, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants