Jump to content

Play Sound to Everyone


fry2010

Recommended Posts

Im not sure if this is the correct section for this question. I have done plenty of searches but cant find anything relating to my question.

What I would like is to press a button in my admin control section and an alarm sound is played to every registered user that is logged in. Is this even possible? The only app I can think that would make this possible is ajax, but im not familiar with this. Any help appreciated.

Link to comment
Share on other sites

Well off the top of my head, first I would add this to all the pages you want to play the sound. It will be the container that the sound loads into.

<span id="loadSound"></span>

 

In your head, you will either need to place your JavaScript, or link to the JavaScript file.

 

next, in the php/html file that will be called, you will need to have this:

<embed src="/music/sound.mp3" loop="false" hidden="true" autostart="true"></embed>

 

It will load into the span tag using AJAX, and play one time.

Link to comment
Share on other sites

Thanks for reply guys. I have pretty much no knowledge of ajax or even javascript for that matter, well I have read a bit on it and seems pretty simple, but I havnt coded anything in it.

Im sorted for this though I basically will be having a javascript chat and some of the packages I have looked at include sounds to be played so Im sorted,  ;D

Link to comment
Share on other sites

Yeah i do understand what ajax does and how it works. My thinking was that if I was to press a button somehow that would need to be delivered to my audience, and because they wouldnt be loading the page themselevs I would need to have sent it to them in an ajax part. Now I think about it a bit more ajax is probably not the thing for it anyway, it probably would even do it. Thanks for help tho I am sorted on this.

I do however have another issue. I dont really want to open a new thread seeming as I have started this one. I dont know if you guys know anyway I can hide an <applet> code from the source code view, as I want to hide the applet. I have read around and it seems like there is no way to do it. I would have thought it should be possible, as php doesnt get loaded into the source code because its generated server side. So would there be anyway to load this applet in that way?

The only other solution would be to place the code outside of the document tree on the hosting platform. But I dont know how I would grab the data from it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.