Skip to content

Store state in localStorage #495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
idleberg opened this issue Feb 20, 2018 · 11 comments
Closed

Store state in localStorage #495

idleberg opened this issue Feb 20, 2018 · 11 comments

Comments

@idleberg
Copy link
Contributor

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?

  • window size & position
  • playlist
  • equalizer setting
  • active Winamp skin / all uploaded Winamp skins
  • play position
@captbaritone
Copy link
Owner

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.

@Fourfingerz
Copy link

Hey this would be an awesome project to tackle! Let me do some research :D

@captbaritone
Copy link
Owner

@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.

@jcubic
Copy link

jcubic commented Mar 25, 2018

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.

@durasj
Copy link
Collaborator

durasj commented Aug 24, 2018

Any progress on this, @Fourfingerz? I would love to have this in the desktop version.

@captbaritone
Copy link
Owner

I'm really not sure how we could handle serializing loaded media files.

@jcubic
Copy link

jcubic commented Aug 25, 2018

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.

@jcubic
Copy link

jcubic commented Aug 25, 2018

Maybe you can have local file system that will save loaded files. Take a look at BrowserFS

@durasj
Copy link
Collaborator

durasj commented Aug 25, 2018

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.

@durasj
Copy link
Collaborator

durasj commented Aug 25, 2018

BrowserFS sounds interesting. Would love to hear if the @captbaritone already thought about implementing it.

@captbaritone
Copy link
Owner

The first part of this will be a system for serializing state (#654). I've started here: #656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants