🔥 we implemented HLS for streaming audio in #[7]​ for a couple reasons:

- chunked audio encoding doesnt send full sourcefile to browser. enables monetization (no right click save)

- works across devices and browsers

- same protocol used by e.g. soundcloud

- open standard

- scales extremely well, just static files

- also supports video

would love if the eventual NIP for audio had support for robust streaming like this. I’m no expert but I’ve spent a good amount of time on our HLS implementation - happy to answer questions or contribute!

Reply to this note

Please Login to reply.

Discussion

this sounds great!

what are you using on the server to serve the chunks?

just a basic fileserver, in our case it’s implemented in Go but you could use an S3 bucket or whatever. just needs to be accessible over http

end to end it goes roughly like this:

1. user uploads an audio file

2. backend uses ffmpeg to convert it into HLS files (chunked mp3s + text manifest)

3. HLS files made available on basic fileserver over http

4. HLS manifest url goes into note metadata

5. client gets note, fetches manifest, (manifest includes time markers + mp3 chunk urls) and JIT loads chunks into player

ah damn, that's super simple; love it

I think this could fit into NIP-94 if we added some additional tags like “stream_url” and “download_url”.

#[6]​ uses a custom kind 1808 for this but only because kind 1063 didn’t exist at the time.