[Jslib] Re: Sound

Pete Collins pete@mozdev.org
Fri, 15 Mar 2002 09:00:48 -0500


Mike Potter wrote:
> I suspect that my problem probably lies with my file problems under 
> windows.


Mike i have a windows box w/ a fresh trunk build.
I hope to have a minute to look at it tonight.

I'll let you know if i get it to work.


--pete



> Mike
> 
> Pete Collins wrote:
> 
>> hrmm, works fien for me.
>>
>> Do note that not all wav sounds play for some reason.
>>
>> I hacked into the jslib window just to test it.
>>
>>
>> <!DOCTYPE  window>
>>
>> <window id="jslib"
>>         xmlns:html="http://www.w3.org/1999/xhtml"
>>
>> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>>         style="min-width: 100px; min-height: 100px; background-color: 
>> white;"
>>         onload="test();"
>>         orient="vertical">
>>
>> <script type="application/x-javascript" src="jslib.js" />
>> <script type="application/x-javascript">
>>
>> function test() {
>>   include(JS_LIB_PATH+'sound/sound.js');
>>   var s = new 
>> Sound('/D/commit_mozilla/mozilla/dist/bin/res/samples/test.wav');
>>   return s.play();
>> }
>> </script>
>>
>> <spring flex="1" />
>> <text value="Welcome to jslib" />
>> <spring flex="1" />
>>
>> </window>
>>
>>
>>
>> Mike Potter wrote:
>>
>>> Here's the error I get:
>>> Error: uncaught exception: [Exception... "Component returned failure 
>>> code: 0x80004005 (NS_ERROR_FAILURE) [nsISound.play]"  nsresult: 
>>> "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: 
>>> chrome://jslib/content/sound/sound.js :: anonymous :: line 44"  data: 
>>> no]
>>>
>>> And here's the code that I used:
>>> include('chrome://jslib/content/sound/sound.js');
>>>     var ThisSound = new Sound( "c:\\windows\\media\\chimes.wav" );
>>> ThisSound.play();
>>>     Mike
>>> pete collins wrote:
>>>
>>>> Mike Potter wrote:
>>>>
>>>>> Anyone have any luck getting the sound functions to work under 
>>>>> windows?
>>>>> I'm always getting some XPCOM errors when I try (sorry, I'm not at 
>>>>> my machine right now to copy the errors).
>>>>> Just wondering if it works.
>>>>> Mike
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> It use to work fine although i haven't looked at it in about 8 months.
>>>>
>>>> --pete
>>>
>>>
>>>