I wan't to create an musicplayer with HTML5. I have already created the drag and drop file from desktop which was pretty easy. Right now it's creating an unordered list with the song names, but i dont know how to capture the song, so when the user presses it, it will play.
This is what i have so far:
var dropbox = document.getElementById("dropbox")
dropbox.addEventListener("drop", function (evt) {
evt.preventDefault();
evt.stopPropagation();
var files = evt.dataTransfer.files;
for (var i = 0, f; f = files[i]; i++) {
var li = document.createElement('li');
li.innerHTML = "<li>" + escape(f.name) + "</li>";
document.getElementById('songs').appendChild(li);
}
console.log("Dropped File");
}, false);
It works great, just need some help to take the next step. I'm thinking that the files should be uploaded to the server before it can be played, but if there is an solution, which not takes up space, but just is when the browser window is open would be great!
Any suggestions?