I don't feel 50 Forums

Go Back   I don't feel 50 Forums > COMPUTERS > Web Design and Graphics Room.

Web Design and Graphics Room. Thread, Add sound to your website in xhtml

Sound on a website can be a pain if your visitor cannot control it, or turn it off. So if ...

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 28th-October-2007, 04:27 PM
CPS's Avatar
CPS CPS is offline
 
Join Date: Jan 2003
Location: Suffolk/ Gender Male
Posts: 1,444
Default Add sound to your website in xhtml

Sound on a website can be a pain if your visitor cannot control it, or turn it off.
So if you want a music file to play make the controls visible.
This was easy to do in html 4 using the "embed" tag.

However this tag does not work and wont validate in xhtml.
You now have to use the "object" tag, it is also harder to do.

I had to search for a few hours, to find the code that is complyant with xhtml and,
that works and will validate.

The code below works in IE, Firefox and Opera,
I am in the dark myself on the actual code but it works.
Notice you have to input the music file in 3 places.
musicfile name plus extension, mp3, wav etc

Code:
<object type="audio/mpeg" width="300" height="40" data="musicfilename.mp3">
  <param name="src" value="musicfilename.mp3" />
  <param name="filename" value="musicfilename.mp3" />
  <param name="type" value="audio/mpeg" />
  </object></p>
Place code in the location required for the controls.
I have a test page to show when I have clearance from the owner of the music copyright.
__________________
Knowledge is not knowing all the answers,
but knowing where to find the answers.

www.smitheram.co.uk

Moderator of, Web Design/Graphics Room.
P4-XP pro-IE7-B/B-ZA-AVG
Reply With Quote
  #2  
Old 30th-October-2007, 10:10 AM
CPS's Avatar
CPS CPS is offline
 
Join Date: Jan 2003
Location: Suffolk/ Gender Male
Posts: 1,444
Default

OK I have had asked Condor for permission to use one of his Music files, permission was granted.

I have added it to my main index page as a test page so you can see the result.

I would like any feed back if you have any problems in hearing the music.

I tested it in IE, Firefox and Opera and it worked OK,
are you asked to download any plugins, let me know.

Courtesy dictates that you credit others work and if any copyright is involved

Here is the link, sound on.
http://www.petersassortment.idf50.co.uk/index2.htm
__________________
Knowledge is not knowing all the answers,
but knowing where to find the answers.

www.smitheram.co.uk

Moderator of, Web Design/Graphics Room.
P4-XP pro-IE7-B/B-ZA-AVG
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:22 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.