Thanks, but in truth the media stuff here isn't the difficult bit as the state of webrtc in 2025 means it's really just a question of shuffling byte buffers around in time. It's really libwebrtc and the browser integrators that deserve the credit.
I have done native mobile libwebrtc work, and that's several other levels of complexity from all this, but with that you can do things like hardware accelerated neural net integration quite easily because of how it's all structured.
I'm new to this and Claude AI talked me into using 'simple-peer' as my library (NPM package) even though the browser's native WebRTC API was almost identical code. I'd be interested in your opinion about what API to use for just a chat app, that does file-sharing. In other words it will be sending around byte buffers (files) as part of the JSON objects. I haven't looked up libwebrtc yet. My WebRTC started as a "Vibe Coding" session last week, and since the results were so impressive I kept on developing it into a full-blow chat app, just for kicks.
So, I am not familiar with "simple-peer" but there are some definite inter-browser quirks relating to datachannels which it might be taking care of.
I seem to recall one browser always prefixes the buffers with sequence numbers, for example. Really fun stuff like that, but I would hope that is history by now.
My preference would be to use the standard webrtc api, and then use a polyfill style library for uniform behaviour if you don't want to worry about it (which it sounds like simple-peer might be).
In the event you want a much higher level API and pre-rolled signalling server etc. my go to recommendation on that would be https://livekit.io/ which I am not affiliated with, but I tend to think people starting out should try that and then be able to explain why they're not using it, much in the same way I would expect a game dev to try using Unreal and have a good reason if they aren't planning on using it.
Right, thanks. Appreciate the advise. I'm a big fan of using whatever libraries there available, in all contexts, as long as I'm using the "dominant" one. I always stick to whatever's most popular because it will be well supported, less buggy, have easily findable documents and resources the web, be "known about" thoroughly by LLMs, etc.
I have done native mobile libwebrtc work, and that's several other levels of complexity from all this, but with that you can do things like hardware accelerated neural net integration quite easily because of how it's all structured.