The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HTML sound options
jmrathbun
post Jun 8 2011, 06:23 PM
Post #1


Newbie
*

Group: Members
Posts: 15
Joined: 8-June 11
Member No.: 14,726



What's the best way to code a button that plays a .wav file? What I have now is <A HREF="$sound"><IMG SRC=soundicon.jpg width=50 height=50 alt="PLAY SOUND"> </A> but that loads an ugly new page that the user has to navigate back from and I'd much rather keep it all on the same page if I can.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jmrathbun
post Jun 9 2011, 06:59 PM
Post #2


Newbie
*

Group: Members
Posts: 15
Joined: 8-June 11
Member No.: 14,726



Since nobody responded, I did some more research and came up with the following bit of code:

<EMBED ALIGN="CENTER" SRC="$sound" HEIGHT="60" WIDTH="145" AUTOSTART="FALSE" VOLUME="50%" MASTERSOUND ></EMBED>

This produces a little control box that doesn't load a new page when it plays. I'm not sure if the user needs to have something like QuickTime installed for this to work, nor whether it works in all browsers. Anybody up for a little testing?

Interestingly, if you select ALIGN="LEFT" the box will appear to the left of whatever the next line of text may be. For ALIGN="RIGHT" it moves all the way over to the margin. ALIGN="CENTER" positions it on the left margin but above the next line of text. The AUTOSTART tag controls whether the sound starts playing as soon as the page loads (an annoyance for most users, I think).

"$sound" appears in this bit of code because it's part of a CGI script so PERL will load the correct file name, such as "sound1.wav". Substitute your own path to the desired sound file(s) as desired.

I haven't found any good source that documents this bit of code so any expert input will be appreciated.

QUOTE(jmrathbun @ Jun 8 2011, 07:23 PM) *

What's the best way to code a button that plays a .wav file? What I have now is <A HREF="$sound"><IMG SRC=soundicon.jpg width=50 height=50 alt="PLAY SOUND"> </A> but that loads an ugly new page that the user has to navigate back from and I'd much rather keep it all on the same page if I can.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
dojam1
post Jul 16 2011, 04:03 AM
Post #3


Newbie
*

Group: Members
Posts: 11
Joined: 16-July 11
Member No.: 14,949



Hope this helps biggrin.gif

http://www.labnol.org/internet/design/html...-websites/2232/
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Jul 29 2011, 11:46 PM
Post #4


This is My Life
*******

Group: Members
Posts: 1,128
Joined: 24-August 06
From: t-dot
Member No.: 16



A lot of it depends on the audio file. Most browsers nowadays will play a lot of audio types natively.

The HTML 5 audio tag http://www.w3schools.com/html5/html5_audio.asp is probably a good way to go, but note that you might need 2 file types to cover all modern browsers.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th April 2024 - 01:02 PM