Reputation: 2176
I'm looking for any of music players created in HTML5, which could store and cache music into Web Storage, so I could play music/playlist on webpage without need of persistent internet connection. What could you recommend, StackOverflow?
Upvotes: 0
Views: 629
Reputation:
There probably won't be any as Web Storage has very limited storage space for things such as this.
Although not defined in the specs, Web Storage has a typical limit at 5 mb. That as string. A string is encoded as UTF-16 in JavaScript which means each char takes 2 bytes. On top of that you would have to base-64 encode the binary data which adds 33% to the size.
This reduces the space into more than half, ie. typical 2 - 2.5mb.
Considering that a typical music piece encoded to "mp3" file usually is larger it becomes evident that Web Storage is not so suitable for this.
There are other mechanisms though such as File System API and Indexed DB (even the now deprecated Web SQL). However, the first has poor support while the others starts to get good support. If there is any players out there supporting these is unknown.
Upvotes: 1