Music player with IPFS backend

Hey folks, Iā€™m building a music player with IPFS support.

App: http://ongakuryoho.com/
Code: https://github.com/icidasset/ongaku-ryoho

I am waiting for the approval of this PR on go-ipfs though:

Would be awesome if someone could look at this PR, itā€™s super small
but necessary for my app to work.

Let me know what you think, thanks :v:

8 Likes

The screenshot looks cool, but I didnā€™t get past the part where it seemingly requires something called blockstack to be installed ā€“ and it apparently doesnā€™t have a release for windows.

Is there a way to try it without a blockstack account (or having to build it from source, if thatā€™s even an option on windows)?

1 Like

@icidasset Is blockstack really needed?

@leerspace @koalalorenzo Yeah, Blockstack is still in alpha. Would be cool to have some alternative to Blockstack, but I havenā€™t found any (yet). Blockstack is used for the authentication and storage of the processed metadata, your favourites and other settings (so it will be persisted across your devices).

Maybe I could add an anonymous mode where all those settings are stored in localStorage or something similar? Thoughts? Iā€™m open to suggestions.

PS. You donā€™t have to build it from source, itā€™s online at http://ongakuryoho.com

Anonymous mode is an interesting idea. As for metadata & settings etc., these could also be stored on the IPFS, right? IPNS, to be precise; you just need an IPNS publishing key shared between all of the userā€™s devices, then every device can update them to whatever the latest setting etc. is.

A public mode could also be nice, e.g. if you have songs of your own you want to make publicly available; then all you need is a website that gathers the IPNS hashes of peopleā€™s public libraries (or they register the IPNS hashes there), with player functionality, social stuff etc., for a kind of distributed SoundCloud. :slight_smile:

And, of course, a system for sharing parts of a library (or even the full one) with friends & family. :wink:

Donā€™t know how to do the authorization thing. Maybe you can even use IPNS keys as a system to authorize users and assign access to certain content?

2 Likes

@icidasset, actually @JayBrown is right: you can use IPFS to store metadata (ā€¦and also encrypt the values) and share the IPNS pub-keys across the devices to technically sync.

The anonymous settings in localStorage would remove the dependency of Blockstackā€¦ that would be awesome! :slight_smile:

Keep rocking, this project has a cool start!

1 Like

@JayBrown @koalalorenzo Thanks for the great feedback! I just added an anonymous mode.

Iā€™ll look into this IPNS thing, I donā€™t know much about IPFS yet.
Iā€™ve also added a small ā€œDSLā€ to make it easy to add new authentication methods:

So hopefully itā€™ll be easy for people to contribute and to add IPNS support.


Thanks for the great suggestions!
I will definitely keep these in mind for the future :smile:
A public mode sounds like a really good idea :+1:

2 Likes

This is working great for me (the logging in part), but now Iā€™m trying to figure out how to get the IPFS integration to work. Does it look like Iā€™m missing something?

After adding an IPFS source Iā€™m getting the following error in chrome.

XMLHttpRequest cannot load http://localhost:8080/ipfs/QmeMoVQGwE5tWTxkS3UJkmkZTwBMrUWciagXn9ErgQ5Bsi. Request header field Range is not allowed by Access-Control-Allow-Headers in preflight response.

So far Iā€™ve tried the following steps (I already had go installed).

  1. go get -u -d github.com/github.com/icidasset/go-ipfs
  2. ln -s $GOPATH/src/github.com/ipfs/icidasset/go-ipfs/ $GOPATH/github.com/ipfs/go-ipfs to allow the make command to complete without errors
  3. cd $GOPATH/src/github.com/icidasset/go-ipfs
  4. make install
  5. cd $GOPATH/bin
  6. ./ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
  7. ./ipfs daemon
1 Like

@leerspace Thanks for trying this out, much appreciated!
Sorry, I forgot a few steps with the CORS setup (I experimented too much with the config) :sweat_smile:

Here are the updated CORS instructions, this should work:

That did the trick! :+1:

This is probably one of the first apps Iā€™ve personally encountered integrating with IPFS that I could see myself using on a daily basis.

This might be user error on my part, but assuming itā€™s not do you have any plans to support flac and other audio formats? So far Iā€™ve only been able to get it to work with mp3s, but itā€™s working great for those.

I agree: since IPFS is cross-platform, such a music player should also support formats like m4a (mp4), mp3, flac, alac, wma etc. ā€¦ not sure if thatā€™s possible right out of the box, e.g. with alac or wma.

Personally, I would highly appreciate production formats like Broadcast Wave (.wav, .bwf) and AIF. Would be great exporting a cue during production, just add it to the IPFS, and the relevant people with correct access can just stream (and download!) it in the original format. (All header metadata intact, like timecodes, production notes etc.) But thatā€™s just meā€¦ always thinking about work, not entertainment. :stuck_out_tongue_winking_eye:

Iā€™m not sure if Iā€™m somehow still running the development version of IPFS (Iā€™m pretty confident Iā€™m running the 0.4.10 release right now), but the site seems to be working for the most part even without using @icidassetā€™s PR. Iā€™m able to add new IPFS sources and play songs from those sources.

I am seeing a couple of errors from elm-loader.js, but Iā€™m not seeing an apparent functional impact.

@leerspace Awesome! :tada: If you do start using the app on a daily basis (which would be amazing, thanks so much) and you encounter any bugs or find that some things are missing, feel free to create an issue on the Github repo.

That said, thereā€™s only support for m4a/mp4 and mp3 right now. Itā€™s using https://github.com/aadsm/jsmediatags under the hood, so maybe, if I ever get to it, I could look into writing additional parsers. But thatā€™s totally not my area of expertise (like at all). But yes, .flac and .wav support would be nice. Iā€™ll look around on Github for some alternative libraries though.

Always thinking about work, same problem here @JayBrown :grin:

1 Like

@leerspace Oh really :thinking: Thatā€™s odd, Iā€™ll look into it, thanks! What are the other errors youā€™re seeing?

EDIT: Just tested it, and it kind of works without using my fork. But Iā€™m getting these kind of errors for some files:

Object {type: "parseData", info: "Offset 1025 hasn't been loaded yet."}

Which is because it doesnā€™t actually return the Content-Range header, which I fixed in my PR.

Those are the ones. For some reason Iā€™m not getting them right now (with vanilla go-ipfs 0.4.10), but Iā€™m not complaining :slight_smile:.

Will do!

Hey @JayBrown

I was looking at integrating this IPNS thing and was wondering about a few things.
Could you answer some of these questions for me?
Totally fine if not :relaxed:

  1. How secure is IPNS? Can I use it to store sensitive data? For example, in my case it would be Amazon S3 secret keys.
  2. What is this publishing key exactly? Is it like a password, in the sense that I keep this key to myself and donā€™t share it with others?
  3. What would be the easiest way for people to start using IPFS/IPNS with my app? Do people set up their own server (eg. brew install ipfs && ipfs daemon) or is there an easier way?

Thanks for your time!

Neither IPNS nor IPFS encrypts your content for you. block-level encryption is planned but right now itā€™s up to you to encrypt the content you put on IPFS.

IPNS does uses private key cryptography to prove who published an update, but it does not encrypt the content itself.

Search around on discourse to find discussions about this topic. Example: Ipfs dynamic content like cms - #6 by flyingzumwalt

Read up on public-key cryptography.
You could start with the wikipedia entry and then explore the idea space. Thatā€™s where you will find the answers you seek.

Write your app as an offline-first distributed app and bundle IPFS with it. You can still run a web-based version of the app, but the downloadable desktop version will be the main thing people use (Like Slack ā€“ where you mainly use the desktop client but can also interact with the same information at slack.com)

1 Like

Thanks for the detailed answers @flyingzumwalt! :smile:

My attempt to add a music source failed. Or rather, the source was added, but no music came through. The console shows me an error: ā€œRequest header field Range is not allowed by Access-Control-Allow-Headers in preflight response.ā€

Iā€™m running go-ipfs 0.4.11-dev (up to date from Git) with your patch to allow content ranges. I applied the patch, did a ā€˜make installā€™ and then restarted the daemon. Do I need to do something further to make it work? Iā€™ve pasted below the ā€˜Gatewayā€™ part of my config file in case I need to make a change there.

Thanks!

ā€œGatewayā€: {
ā€œHTTPHeadersā€: {
ā€œAccess-Control-Allow-Headersā€: [
ā€œX-Requested-Withā€
],
ā€œAccess-Control-Allow-Methodsā€: [
ā€œGETā€
],
ā€œAccess-Control-Allow-Originā€: [
ā€œ*ā€
]
},
ā€œPathPrefixesā€: ,
ā€œRootRedirectā€: ā€œā€,
ā€œWritableā€: false
},

Thanks for testing this @JamesVasile!

Your config doesnā€™t look right, ā€œAccess-Control-Allow-Headersā€ should also specificy ā€œRangeā€ and ā€œContent-Rangeā€ as per the instructions (ie. the link on the ā€˜add new sourceā€™ page -> https://gist.github.com/icidasset/c1883d594574a958ae4b4a5a91db1070)

Let me know if that works for you.

PS. That ā€˜add new sourceā€™ page will be improved in the future, itā€™s a bit of a mess atm :sweat_smile: