简体   繁体   中英

Streaming chunks of mp3 file from server and playing them on client

I am trying to build an internet radio and have stumbled upon the problem mentioned on the title.

To be precise, I want to be able to send chunks of an mp3 (or any other audio format that can do the job) file from a server to the clients so that at any moment, all clients are listening to the same part of the song.

I also, understand that the same thing could probably be achieved by only notifying the clients of the exact location in the song the clients should start from. I have not experimented with this solution a lot yet.

I have seen that this question has been answered here but I was wondering if someone has gotten to a better point in the years that followed that post.

Thank you in advance.

All you have to do is send them over HTTP. Then, the clients can use the regular audio element.

const audio = new Audio('https://stream.example.com/woot');

This is exactly how streaming with SHOUTcast/Icecast works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM