ZzFXM icon indicating copy to clipboard operation
ZzFXM copied to clipboard

Song "Link" (share link for showing off a creation)

Open elliot-nelson opened this issue 5 years ago • 3 comments
trafficstars

It would be nice if, while playing around with songs, there was a way to share a link to an embedded song in the tracker.

Max URL length is generally ~2000 characters, which is easy to go over for a song with a few patterns, so we might need to do one or more of:

  • Build in an all-javascript gzip and see if you could crunch songs by gzip+base64 and put them in URL? Certainly this would just increase the max length (maybe it's closer to 4000 characters with this approach).
  • Nuclear option, actual backend somewhere so the url can be just /2935239 and pull the song up. Would need to have some kind of netlify or heroku app running in this case.
  • Alternative -- maybe you could piggyback a public upload, like a gist? If you could start the tracker with ?gist=<gist url> then users could upload a song to a public gist and make a link to it like that. No database necessary in that case.

elliot-nelson avatar Nov 09 '20 19:11 elliot-nelson

You could use JSON crush to share urls, the compression is actually better then zipping in most use cases.

https://github.com/KilledByAPixel/JSONCrush

KilledByAPixel avatar Nov 09 '20 20:11 KilledByAPixel

I agree. Song sharing could be easier to deal with.

  • I added a zip library to a recent release of the tracker for reporting compressed size, so Zip + URL encoding is an option, as is JSON crush. Constraining songs to 2K bytes after compression could cause problems though — especially if authors want to keep metadata and unused patterns.
  • I really don't want to add a backend to this project as it's another thing to maintain.
  • You can load a song into the tracker by passing ?url= in the URL (provided the server sends the correct CORS headers) — for example: https://keithclark.github.io/ZzFXM/tracker/?url=https://raw.githubusercontent.com/keithclark/ZzFXM/master/examples/songs/sanxion.js. I did this to allow authors to submit their open source songs to a ZzFXM repo I set up. It should with gists.

Plenty to think about.

keithclark avatar Nov 09 '20 21:11 keithclark

Ah, so probably anyone could push a song as a json file into any repo and load it with the URL option, right? If so that doesn't make it "easy" to share a song but you can make it easy for the recipient to play.

elliot-nelson avatar Nov 09 '20 23:11 elliot-nelson