DracotMolver / soube

Music player based on electronjs
MIT License
32 stars 4 forks source link

Slow response #10

Open ghost opened 6 years ago

ghost commented 6 years ago

If I click the name of a song, it take about 5 seconds before it starts playing. This is not acceptable. Using Windows

DracotMolver commented 6 years ago

This is because it's a heavy process for the web audio api. If the file size is bigger, more time it will take to play it because you make an xhttprequest which returns an Arraybuffer (big one) that you pass to the web audio api. The way how I'm "solving" a little bit this issue, is preloading the next songs, but this is only when the songs are playing by the music player and you don't select the song. Most of music player save the data in memory. The new version will be like this, but as a said, it's not full-save-memory. I'm willing to use the IndexDB but I have the limitation of the browser. I'm concerned of your issue. Thanks :)

ghost commented 6 years ago

Cant you use fetch?

http://developer.mozilla.org/docs/Web/API/Fetch_API/Using_Fetch

DracotMolver commented 6 years ago

It was an option in some moment. But sadly ( again XD ), the fetch funciton doesn't work with files as a protocol or URL scheme :(. Because if this, I tried another thing; use xhttprequest with workers but workers can't send arraybuffer as data :(. But, I think the new version will solve some issues in the code and also UX improvements.