View Full Version : Play sound when page updates

08-01-2007, 09:39 AM
I have a webpage with a lot of dynamic content, for example several different discussion boards, blogs and similar. I plan to make a page that monitors all of these boards and blogs, for example with a query from the MySQL database that shows the ten last entries in all the boards and blogs. The page will update every minute. Such a page will make it easier for people to monitor what is going on on my website.

However, is it possible to play a sound every time the content of the page is changed? For example if a new blog entry is added a sound is played. I guess there has to be some way of detecting that the page is changed? Do you have any suggestions as to how I can solve this?

My pages are built with PHP and MySQL.

Thanks in advance!

08-01-2007, 10:49 AM
You could use an embedded streaming media codec ...


Web pages that are chock full of bells and whistles (literally) have a tendecy to make me want to smash the PC ... :D There's nothing worse when I'm really getting into my favorite ambient track on Mediaplayer and concentrating on writing PHP when all of a sudden a web page in a browser that I'm *NOT* currently looking at goes *BEEEEP*! :mad: Hammertime ...

08-01-2007, 11:31 AM
There will be an option to turn the sound off. As this page is intended to be a notification page there is no reason to be annoyed if a sound is played. :) It is kind of like being notified of a new e-mail or MSN message. You have the window open while at work, and if there is a new board entry you are notified. This allows you to stay focused on the work as there is no need to check the boards “manually” all the time.

Back to your answer: I have never worked with embedded streaming media codecs and I’m not quite sure how to solve this problem with such codecs. Do they work in all operating systems and browsers?

08-01-2007, 11:53 AM
A lot of browsers support them as a downloadable plug-in ... BUT they are not cross-browser! Also, the client must explicitly download the plug-in, and such plugins do represent a security risk (e.g. the Trojan.emcodec).

Here's a little tutorial I found: http://www.tips-tricks.com/sound.asp

There's plenty more tutorials out there on the net. Even so, I would question the value of playing a sound ... personally, I have all sounds on my MSN messenger turned off and I have the Win XP start up/shut down tunes turned off. Under Win XP, a minimised or unfocused browser will flash at you from the taskbar if its content changes - you don't have to add anything extra to the webpage to make it do this. If you want extra notification, its very straightfoward to lauch a cross browser pop-up but much harder and less secure to play a cross-browser sound.

08-01-2007, 12:55 PM
If you want extra notification, its very straightfoward to lauch a cross browser pop-up but much harder and less secure to play a cross-browser sound.

How can the updated content be detected and in some way highlighted without using sound? Any suggestions?

08-02-2007, 11:15 AM
It depends on how you refresh the page content - you could stick in a bit of javascript to generate an alert box. More than that I cannot say without knowing how your site operates - there's many ways to do it, some will be more suitable to your site than others.

The simplest thing is to allow XP to automatically alert the user via a flashing button on the taskbar, as I've explained.