UCL DEPT OF PHONETICS & LINGUISTICS

Demonstration of Different Ways to Play a Sound from a Web Page

Here are some examples of sound replay from a web page. View the HTML source of the page to see how it's done. These examples have only been tested on a PC.

Browsers tested: Internet Explorer (6.0), Firefox (1.0), Mozilla (1.7.5), Opera (7.52). Plug-ins tested: Windows Media (10.0), Quicktime (6.5.2).


16 March 2006: Due to a "security" update by Microsoft many of the old means for playing sounds no longer work.

20 April 2006: Options 3 and 4 have been updated with some (crude) work-arounds.

8 May 2006: If you are getting "Click to run an ActiveX control on this webpage", then try putting your JavaScript in its own .js file then including it in the page with <script src="file.js"></script>. Here is an example.


1. Normal Hyperlink to a Sound File

This is the simplest way, but usually causes a helper application to be launched to play the sound. Also, the sound doesn't start playing until it has been downloaded, and the downloading doesn't start until you click on the link. Worse, some helper applications start to play the sound before it is downloaded enough and stop playing part way.

Compatibility: Internet Explorer, Mozilla/Firefox, Opera.

2. Embedding a Sound File

The EMBED tag causes the sound file to be downloaded when the page itself is downloaded (just like an image would be). The browser then looks for a Plug-In to play the file. Internet Explorer will typically use the Windows Media Player plug-in for sound files. Mozilla requires you to install a suitable plug-in such as Quick Time. A disadvantage of the EMBED tag is that because you do not know the dimensions or the name of the plug-in, it is hard to control the size and format of the player's appearance.

If this doesn't work, look here for more help on plug-ins for audio replay.

Compatibility: Internet Explorer, Mozilla/Firefox, Opera.

<