Closed idleberg closed 6 years ago
I agree this would be cool! I think we should only do this if we can persist the audio file as well, otherwise it would seem more confusing than helpful. Looks like the size ceiling of indexdb is higher than that of localstorage, so that would probably be a better starting place.
If we go down this road, it would be cool to make it abstract enough that it could also be made to work for other data-stores like Dropbox.
Hey this would be an awesome project to tackle! Let me do some research :D
@Fourfingerz Great! I'd be very interested to hear what you learn. Everything except the actual audio should be possible to persist via some kind of Redux store enhancer since I've taken pains to keep the entire store serializable. The only "hard" part should be how we handle the media files. There are two types of audio files: URLs (easy to serialize) and local files. Figuring out how to serialize/deserialize those may be the hard part. Currently they are stored in the state as URLs created via URL.createObjectURL, but those URLs are only good for the lifetime of the page.
This is would be very useful for me as well. as for media files (I'm using ajax to load them) I would store file names in localStorage and on init I will load them again so no files in localStorage by winamp is fine.
Any progress on this, @Fourfingerz? I would love to have this in the desktop version.
I'm really not sure how we could handle serializing loaded media files.
You can take a look how I created persistent playlist in my project (I din't work on this much lately) but I fetch them from the server https://github.com/jcubic/swift.manager/blob/master/apps/winamp/init.js (filepicker have hardcoded path to my local directory with mp3 files).
So for me I would only like to have position of the windows save and restored or API that will allow me to position and size them individually.
if you're using local file using open or drag and drop there is no way to restore the media files.
Maybe you can have local file system that will save loaded files. Take a look at BrowserFS
I guess those that can't be stored easily just won't. Better than nothing. Later we can iterate on that. For the desktop app, I'll maybe think about overriding file picking so that I can save local file paths.
BrowserFS sounds interesting. Would love to hear if the @captbaritone already thought about implementing it.
The first part of this will be a system for serializing state (https://github.com/captbaritone/webamp/issues/654). I've started here: https://github.com/captbaritone/webamp/pull/656
It would be great if the state of the entire app would be stored in localStorage (or IndexedDB), so the next time I visit the page everything is setup as before.
What could be stored?