I have a mp3 file on my server.
And i want all my clients who visit that url to listen to that music in sync.
That is.
Lets say the file plays for 6 minutes.
I start the song at 10:00am
A request which comes at 10:03am should start listening from the 3rd minute of the song.
All my clients should listen to the song in sync.
How can I achieve this with nodejs and socket.io?
EDIT: If you want to do exactly what was asked the answer on the link is a much better match:
https://stackoverflow.com/a/26029102/67945
My original answer looses itself on the benefits of ipv4 multicasting.
What you are looking for is streaming.
The benefits added to the usage of streaming (opposed to every client having it's own open connection) are specially visible as your listeners base grow but the feed remains using the same bandwidth. Else you would grow into bandwidth problems pretty fast.
Streaming is a protocol (as http) and you can check a list of Streaming Servers here.
A very popular (and free) streaming server is IceCast.
And with a little Flash you can have a client player.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With