๐Ÿ’พ Archived View for bbs.geminispace.org โ€บ u โ€บ clseibold โ€บ 5399 captured on 2023-12-28 at 17:05:40. Gemini links have been rewritten to link to archived content

View Raw

More Information

โฌ…๏ธ Previous capture (2023-11-14)

๐Ÿšง View Differences

-=-=-=-=-=-=-

Comment by ๐Ÿš€ clseibold

Re: "AuraGem Music Public Radio"

In: s/AuraGem

@mediocregopher Thanks for trying it out. What android client are you using? I think lagrange on mobile has a problem with streaming mp3 files, but I thought that was specific to the spartan protocol. Someone else mentioned that the streaming worked on Rosy Crowe (or whatever it's called, haven't used this client myself).

Btw, I read your post about Mobile Streaming. It was interesting because some of the things you talked about are some of the things I had to tinker with to get this to work.

On upload of music files, I get the bitrate of each file so I know how fast to livestream the data, since I can't actually tell if clients have finished playing the audio due to it being an infinite stream of mpeg data.

And then I have this "fake client" goroutine that just acts like a fake client that's "streaming" the radio and it handles setting the current location of the current song, and then when it finished "playing" the song (getting to the end of the mp3 file), it tells another goroutine to change the current file to the next song and change the current location to 0 (well, the location after the ID3v2 tags).

Then that broadcasts telling the fake client and all clients that the song has changed, and then they open the file and start sending the new file data over (and the fake client continues its process of fake "playing" the song and setting the current location in the file of the current song).

When a new client joins, it just opens the file and gets the current location (as set by the fake client) so that it's up to date with the rest of the clients.

It took me like 3-4 days to get this all working lol. There were definitely some problems in the beginning, but I'm so happy I figured it out!

P.s.: For that android client, I suspect, like you said, it's trying to download the whole file before starting to play it. This used to be the case for more clients until people started realizing streaming is a thing (even text streaming!) and so solderpunk made it clearer that streaming is allowed, and that connections are infinite unless they are deliberately closed by one party (the client or server), which dramatically helped the streaming situation. Tomasino, and a few others, got the ball rolling on the streaming stuff, and I supported it from the very beginning.

However, some clients don't allow for streaming because they either timeout, or don't display/play as data comes in, but after it's all downloaded and the connection has closed.

There are more clients besides Lagrange out there that allow for streaming on desktop, but I'm not sure what the situation is like for android or iOS.

There's more info about how streaming became a thing and was allowed in the Gemini History Must Reads page that I have:

โ€” auragem.letz.dev/GeminiHistoryMustReads.gmi

๐Ÿš€ clseibold

Sep 18 ยท 3 months ago

7 Later Comments โ†“

๐Ÿ‘ป mediocregopher ยท Sep 18 at 16:36:

@clseibold I'm using Rosy Crow on android, so not sure what's going on there. Maybe the issue is at the OS level somehow...

I had forgot about the figuring out the song bitrate in order to know how fast to dump the data onto the socket, that was yet another wrinkle :)

๐Ÿš€ mbays ยท Sep 19 at 05:55:

Nice. Works perfectly in diohsc (piping the stream to mpv). It's maybe a shame that you can't get track metadata in the stream, as with icecast streams. This seems to be impossible with mp3. I don't know about ogg vorbis.

๐Ÿš€ mbays ยท Sep 19 at 06:05:

@clseibold Did you think about also having "public account" for auragem allowing upload of royalty-free music?

๐Ÿš€ stack ยท Sep 19 at 12:40:

Which Gemini browsers (especially Android) are capable of streaming music? I was just thinking that I don't need anything but Lagrange, but sadly it does not play streams on Android.

๐Ÿš€ clseibold ยท Sep 19 at 13:51:

@stack Gaaah! Ok. So, I just found out that audio doesn't stream on Lagrange if you are on iOS, Android, or AppImage. There's no other way to do gemini audio streams, afaik, from iOS and Android until @skyjake fixes Lagrange. I have no idea about the AppImage situation and if there is a different non-AppImage version, but I believe someone else got the streams to work on Linux, so there must be.

I will be trying to speed up the development of my own vlc player that supports gemini links, because all the problems with existing gemini clients are getting annoying.

@mbays I'm glad it worked on one other client! lol. I'll add diohsc to the list of supported clients (and specify that you pipe it into mpv, and probably can pipe it into vlc too, I would guess).

I have thought about ways that people could upload public domain and royalty free music (as well as their own music). More on this coming soon :)

Thanks for trying it out and the feedback!

๐Ÿš€ skyjake ยท Sep 19 at 19:17:

Those builds of Lagrange that use the mpg123 software decoder (all desktop versions) should stream MPEG audio just fine. However, this decoder library is an optional dependency so it is possible the AppImage has some build config issues. I'll have to investigate.

When it comes to iOS and Android, software decoding and playback via SDL โ€” like it is done on desktop โ€” is unfortunately not a good idea because it is too inefficient. Your device will run hot and run out of battery, and that is unacceptable. Instead, the mobile builds need platform-specific code to use native audio APIs and hardware decoders.

On iOS, native audio playback is already implemented, but only for fully downloaded files when the app can hand over a complete "audio/mpeg" file to the native API.

On Android, native audio playback is similarly possible for audio files that have already been downloaded.

Streaming over Gemini and playing back via native APIs is not implemented on either platform. The amount of work required here is significant, and it is difficult to justify prioritizing it because this particular use case is very niche in Geminispace, because neither streaming nor audio are Gemini's "core competencies".

I would certainly want to implement support for better audio playback at some point, but there are more important things to invest my time into.

That said, if anyone has relevant iOS/Android code (playing streaming audio), you can send it my way. It should help make the eventual implementation easier.

๐Ÿš€ clseibold ยท Sep 19 at 19:27:

@skyjake Thanks for the response and for the clarifications. I didn't realize the mobile platforms made it so hard to do audio streaming. Seems like every developer I've known that has programmed for Android has complained about Android being annoying to program for. I'm considering workarounds since the situation on mobile is hard to deal with for those who have made gemini browsers for them.

I will say, however, that I don't think the audio streaming is as niche as you think it is, I just think it's *new*, which is different than saying it's niche. I've gotten a surprising number of comments, likes, etc., and traffic at AuraGem, since I launched AuraGem Music and the public radio.

Also, Gemini has had lots of music files served over it from its very beginning (e.g., Konpeito), which makes sense since it has some overlap with SDF and SDF's anonradio.

Original Post

๐ŸŒ’ s/AuraGem

โ€” auragem.letz.dev/music/public_radio

AuraGem Music Public Radio โ€” AuraGem Music's Public Radio is now live! It plays all public domain music currently. You can find a schedule of what music plays when on the homepage.

๐Ÿ’ฌ clseibold ยท 11 comments ยท 4 likes ยท Sep 18 ยท 3 months ago