Problems of Creating Webpages with Sound Files

By David Alderoty

This article is written for people that build websites with sound files, and know how to edit HTML code.

 

You can contact the author by e‑mail David@TechForText.com or by 

left clicking on these words for a website communication form

 

 

 

 

The Challenges In Creating Webpages with Sound Files

There are difficulties with creating webpages with audio, but if you are using the optimal code you will have less of a problem.  With most code the audio will start in some web browsers, but not with others.  This problem is aggravated by the fact that there are a number of popular brands of web browsers, and many people have older versions of these browsers.  There are also security-devices built into some web browsers that block audio files from starting automatically.  The blocking can usually be circumvented by a viewer of a webpage, if they have enough patience, and basic skills to click on appropriate buttons.  In general, I have found that the Opera web browser presents the most problems when starting sound files, and Firefox and Internet Explorer the least difficulty.  Some of these problems would be minimized, if everyone had the latest web browsers, or better yet, if everyone had the same brand of browser.  Eventually these problems might be solved by a uniform set of standards for web browser design, but for now there are some solutions in the following paragraphs.

 

 

 

The Problem of Starting Sound Files With Hyperlinks

A simple hyperlink works well with all browsers, and it can be used for opening a sound file in the webpage. The user clicks on the link and a sound file starts.  However, there is a major problem with this technique, because the webpage is concealed when the sound file starts.  The viewer of the website can of course display the concealed page by clicking on appropriate tab in the browser.  However, many viewers would probably interpret this as a malfunction in web design, and they might search for another website.  To see the results of this problem, left click on these words, and a sound file will start, but problematically this webpage will be concealed.  NOTE if you have the Opera web browser, after you click on the above link, you will see an icon, which you must click on to start the sound file.

 

 

 

How to Prevent a Website from Being Concealed When Hyperlinks Are Used to Start a Sound File

I have devised a solution that prevents websites from being concealed, when hyperlinks are used to start a sound file.  This involves creating two webpages, which I will call OPENING-PAGE, and SOUND-PAGE.  The SOUND-PAGE is set up to start the sound file automatically, as soon as it is opened, by utilizing appropriate code (as explained two headings below).  The OPENING-PAGE contains a hyperlink to the SOUND-PAGE. When the user clicks on the link in the OPENING-PAGE, the SOUND‑PAGE opens, and the sound file starts automatically.

     

 

 


Important Note for the Technique Described Above

With the technique described above, the SOUND-PAGE could be an exact or partial duplicate of the OPENING-PAGE, because its primary purpose is to prevent the webpage from disappearing when the user clicks on a hyperlink to start the sound file.  When this is the case, you should place appropriate code in the SOUND-PAGE to prevent problems from the search engines.  This is because search engine companies, such as Google, sometimes lower the ranking or refuse to index websites for displaying duplicate content.  There are several types of code that can be used to prevent these problems.  However, the simplest solution is to use code that will prevent a specific webpage from being indexed, such as the code presented below.  I obtained this code from Google Webmasters Central Blog: http://googlewebmastercentral.blogspot.com/2007/03/using-robots-meta-tag.html  This code should be placed just under the <head>, as indicated below:

 

<html>

<head>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">

<title>...</title>

</head>

 

 

 

The Code to Start Sound Files Automatically

There are many code configurations for starting a sound file automatically as soon as a webpage opens, but they do not work well with all web browsers.  However, I obtained code that solved this problem with most of the browsers I tested.  The code was obtained from an article: How To Embed Sound on a Web Page, By Jennifer Kyrnin at http://webdesign.about.com/od/sound/ht/htsound.htm.  This code is presented below, and it will start sound files in most web browsers because of its apparent redundancy.  That is if a browser cannot start the sound file with one segment of the code, it will automatically try the other segments.  However, with this code the Opera web browser, version 15, did not start the sound files automatically, but an icon was displayed, to start the sound by left clicking on it.

 

<object>
< param name="autostart" value="true">
< param name="src" value="
eureka.wav">
< param name="autoplay" value="true">
< param name="controller" value="true">
< embed src="
eureka.wav" controller="true" autoplay="true" autostart="True" type="audio/wav" />
< /object>
   

 

I added the red color to eureka.wav, because it has to be replaced with the name and location of the sound file you want to start.  It is easy to modify this code to meet your specific needs.  For example, if you have a very short sound recording, or very important audio message, you might want to remove the controller, which is done by changing true to false, such as controller" value="false” and controller="false"  If you do not want the sound file to start automatically, change all of the following to false: "autostart" value="false", "autoplay" value="false", autoplay="false", and autostart="false"  When this is done, the controller value must be set to true.  If this is not done there will be no way to start the sound file.

 

 

 

If You Want Additional Information

 

If you want more information on the problems and potential solutions for creating webpages that have sound files, see the following websites.

Different Ways to Play a Sound from a Web Page

www.phon.ucl.ac.uk/home/mark/audio/play.htm

 

Problems, Problems, and Solutions

www.w3schools.com/html/html_sounds.asp 

 

 Playing Sound from JavaScript 

www.javascripter.net/faq/sound/play.htm 

 

HTML: Why does embedded audio sometimes fail to play?

http://stackoverflow.com/questions/246443/html-why-does-embedded-audio-sometimes-fail-to-play