Anyone have experience with audio streaming on browsers? I've currently set up a solution that uses socket.io and custom opus encoding/decoding, but this has lead to around 3s of streaming delay and feels like a bit of a hacky solution. There are a technologies out there such as WebRTC, HLS but I shied away from them because of browser support.
Opus is 30% smaller than mp3 at an acceptable quality and in my case I'm expecting bad internet connections at both recorder and receiver so that's why I'm going for the least amount of data. The bad thing about opus is that it is not supported on older browsers, but it's poly fillable by a custom monster 600kB asm.js library. Why asm not webassembly? Because if it's not supported it will fall back into normal js. Why socket.io? Because of room management and because websockets are supported by almost every browser from the beginning of time. That is, I'm expecting people to use Iphone version potatoes to listen to the audio.
- I record PCM audio and encode it into opus packets and emit through the server into a socket.io room.
- On receiver side I listen to packets from the mentioned room, decode and play them using Web Audio API
- I'm using packets, is there a argument for using streams instead?
- Is streaming audio (in the future maybe video) through websockets just a bad idea?
- Is there any gotchas using websockets, such as packet sizes or rate of packets?
- Should I just opt for technologies like HLS, Webrtc or idk, ffmpeg media server?