as in the comments mentioned, you can go on with the socket principles. Basically for me the choice was socket.io
in nodejs
. With this I wrote a chat application. As you know it is almost the same pattern with your use case. I had to broadcast the messages to all the clients in the same chat group. Socket.io has also a client library, where you can listen to events. You can define your own event and broadcast them to clients which are listening to the event and the socket.
Good luck!
function play(){
var audio = document.getElementById("sound");
audio.play(); }
<button onclick="play()">Press</button>
<audio id="sound" src="123.mp3" ></audio>
What I want to do is to play sound for everyone who’s currently on website. Is this possible? Which language or method should I search for?
PS. This is my second try to ask question correctly, hope I did it right this time.
Hi. For doing something like this you would need a server to connect to. For example WebSockets. This way you could tell the server, to broadcast a message to all the users of the site.