Closed francoisschwarzentruber closed 1 year ago
The issue is solved, except that it may maybe require some explanations in the documentation.
The problem was very weird: using a midi-player DOM element is not like a div, span etc. With "midiPlayer" I do not get the DOM element, but a weird object. It works with document.getElementById("midiPlayer"):
document.getElementById("midiPlayer").src = "https://magenta.github.io/magenta-js/music/demos/melody.mid";
Maybe explain that point in the documentation (README.md)?
I guess the "weird object" that you get with midiPlayer
is (coincidentally) the JavaScript module itself.
AFAIK directly accessing elements by using their ID as a JavaScript identifier is generally discouraged exactly because of collisions like this, and getElementById
is the way to go. So I'm not sure this merits a special mention in the documentation.
Very nice player! However when I do: midiPlayer.src = "https://magenta.github.io/magenta-js/music/demos/melody.mid"; it does not change the file of the player :(. Should I run a function to load the file?