Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > sound width javascript

Reply
Thread Tools

sound width javascript

 
 
Gandalf
Guest
Posts: n/a
 
      08-24-2007
I need to create sound with Javascript. Until now all the code I have
been trying doesn't work width Firefox. can some one please show me
how to do it, or give me a link to a good article?

thanks

 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      08-24-2007
Gandalf wrote:
> I need to create sound with Javascript.


Generally, you cannot do that with a Web browser. You can create (X)HTML
elements that refer audio media and/or you can access plugin APIs to play
that audio media.

> Until now all the code I have been trying doesn't work width Firefox.


"Does not work" is a useless error description. [psf 4.11]

http://www.jibbering.com/faq/faq_not...ml#ps1DontWork

> can some one please show me how to do it [...]


Show the relevant part of your code, or post a URL of a test case.


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
 
Reply With Quote
 
 
 
 
Gandalf
Guest
Posts: n/a
 
      08-24-2007
On Aug 24, 11:03 am, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
wrote:
> Gandalf wrote:
> > I need to create sound with Javascript.

>
> Generally, you cannot do that with a Web browser. You can create (X)HTML
> elements that refer audio media and/or you can access plugin APIs to play
> that audio media.
>
> > Until now all the code I have been trying doesn't work width Firefox.

>
> "Does not work" is a useless error description. [psf 4.11]
>
> http://www.jibbering.com/faq/faq_not...ml#ps1DontWork
>
> > can some one please show me how to do it [...]

>
> Show the relevant part of your code, or post a URL of a test case.
>
> PointedEars
> --
> var bugRiddenCrashPronePieceOfJunk = (
> navigator.userAgent.indexOf('MSIE 5') != -1
> && navigator.userAgent.indexOf('Mac') != -1
> ) // Plone, register_function.js:16


OK this is my element

<BGSOUND id="BGSOUND_ID" LOOP=1 SRC="IncomingIM.mp3">
<EMBED NAME="Bach" id="Bach" SRC="IncomingIM.mp3"
LOOP=FALSE AUTOSTART=FALSE HIDDEN=TRUE MASTERSOUND>

this is the function

function playSound() {
document.all['BGSOUND_ID'].src='IncomingIM.mp3';
document.getElementById('bach').play(false)
}
it works only on IE
thank you!

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      08-24-2007
Gandalf wrote:
> OK this is my element
>
> <BGSOUND id="BGSOUND_ID" LOOP=1 SRC="IncomingIM.mp3">
> <EMBED NAME="Bach" id="Bach" SRC="IncomingIM.mp3"
> LOOP=FALSE AUTOSTART=FALSE HIDDEN=TRUE MASTERSOUND>


http://validator.w3.org/ will tell you that neither element is part of any
standard. Use the `object' element instead.

> this is the function
>
> function playSound() {
> document.all['BGSOUND_ID'].src='IncomingIM.mp3';


document.all is another IE-ism that is only recently partially supported
by Gecko-based UAs in Quirks Mode (a bad move IMHO). Standards compliant
referencing won't help much here though, because the underlying markup is
not standards compliant.

> document.getElementById('bach').play(false)


This might work if the element object reference could be retrieved (that is
assuming the proprietary `embed' element is reflected in the DOM) and the
used plugin had a play() method. But you don't tell which media player
plugin you use, let alone the UA where you have tested this to fail, or what
error messages you get. Read the FAQ Notes section I pointed you to, again.

> }
> it works only on IE


That is not surprising, most of this is MSHTML-only. But which of the
numerous IE versions have you tested with? Which other UAs have you tested
with? Again, you are providing far too little information for an analysis.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
 
Reply With Quote
 
elephant
Guest
Posts: n/a
 
      08-24-2007
On Aug 24, 3:58 am, Gandalf <(E-Mail Removed)> wrote:
> I need to create sound with Javascript. Until now all the code I have
> been trying doesn't work width Firefox. can some one please show me
> how to do it, or give me a link to a good article?


If you're willing to spend $5 (I think, maybe just $1), you can go to
www.istockphoto.com and download a Flash sound player. Most don't
require you to have Flash, and just have an XML file you can edit with
the URL of the audio you'd like to play. There are others free online
but the ones I've seen require you have Flash to edit the file.

It wont play on computers that don't have Flash installed, but, most
do these days.

If you need more info, or a specific link to one I've used before, let
me know. I didn't post one because the design may not match your
site, and I'm a bit worried people will think I'm linking to one of my
own.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
JComboBox width, dropdown list width Xu Java 11 07-15-2005 11:54 PM
min-width max-width again Paul Furman HTML 10 02-09-2004 06:20 PM
Table width and columns width kris HTML 11 11-18-2003 06:49 AM
Re: resized image in table extends table width to original image width Sean Jorden HTML 1 08-19-2003 08:59 AM



Advertisments