w3schools
  
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About

Playing Sounds on a Web Site

« Previous Next Chapter »

Sounds can be played "inline" or by a "helper", depending on the HTML element you use.


Inline Sound

When sound is included in a web page, or as part of a web page, it is called inline sound.

If you plan to use inline sounds in your web applications, be aware that many people find inline sound annoying. Also note that some users might have turned off the inline sound option in their browser.

Our best advice is to include inline sound only in web pages where the user expects to hear the sound. An example of this is a page which opens after the user has clicked on a link to hear a recording.


Using A Helper (Plug-In)

A helper application is a program that can be launched by the browser to "help" playing sound. Helper applications are also called Plug-Ins.

Helper applications can be launched using the <embed> or the <object> tag.

One great advantage of using a helper application is that you can let some (or all) of the player settings be controlled by the user.

Most helper applications allows manually (or programmed) control over the volume settings and play functions like rewind, pause, stop and play.


Using The <embed> Tag

The purpose of the <embed> tag is to embed multimedia elements in web page.

The following code fragment displays a MIDI file embedded in a web page.

Example

<embed src="beatles.mid" />

Try it yourself »

Note: The <embed> tag is deprecated. The World Wide Web Consortium (W3C) recommend using the <object> tag instead.


Using The <object> Tag

The purpose of the <object> tag is to embed multimedia elements in web page.

The following code fragment displays a WAVE file embedded in a web page.

Example

<object
classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="FileName" value="liar.wav" />
</object>

Try it yourself »


Using A Hyperlink

If a web page includes a hyperlink to a media file, most browsers will use a "helper application" to play the file.

The following code fragment displays a link to a MIDI file. If a user clicks on the link, the browser will launch a helper application, like Windows Media Player to play the MIDI file:

Example

<a href="beatles.mid">Play the Beatles</a>

Try it yourself »

« Previous Next Chapter »


The Creators of XMLSpy are Pleased to Announce

The MOST WANTED features for Developers and
IT Professionals in Version 2010

Collect your handsome reward! Download a free trial and experience more than 70 of the Most Wanted features including:

  • JSON editing & conversion in XMLSpy
  • WSDL 2.0 editing in XMLSpy (adding to WSDL 1.1 support)
  • WSDL 2.0 data mapping in MapForce
  • Numerous data mapping enhancements in MapForce
  • Numerous stylesheet design enhancements in StyleVision
  • XML Schema comparison in DiffDog
  • And much more!
Fully functional 30-day free trial of the Altova MissionKit
Altova XMLSpy


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting
Top Web Hosting
Windows Hosting
WEB BUILDING
Download XML Editor
FREE Flash Website
FREE Web Templates
FLIGHT TICKETS
Find the cheapest flight
to any destination now!
EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification
STATISTICS
Browser Statistics
Browser OS
Browser Display