Bug 28439 - Audio object created by JavaScript codes doesn't play.
Summary: Audio object created by JavaScript codes doesn't play.
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Plug-ins (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL: ttp://www.benjoffe.com/code/demos/can...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-18 15:40 PDT by Lyon Chen
Modified: 2009-08-19 08:03 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lyon Chen 2009-08-18 15:40:44 PDT
In website http://www.benjoffe.com/code/demos/canvascape/, an audio object is created with following code:

var audio = window.Audio && new Audio("shoot.wav");

And when "audio.play();" is executed, it won't play with WebKit based browser, like Chromium, Safari.

The reason is probably that this Audio object is not attached to the DOM tree.
Comment 1 Eric Carlson 2009-08-18 17:16:18 PDT
An audio element should play whether or not it is in the DOM, and I hear the shoot sound when I press the "B" key on both OSX and XP.  Can you play the sound file (http://www.benjoffe.com/code/demos/canvascape/shoot.wav) when you load it directly?
Comment 2 Lyon Chen 2009-08-18 19:20:33 PDT
Yeah, I can hear the shoot sound when using the direct link, and I can hear the shoot sound in FireFox when press "B" key too.
Comment 3 Eric Carlson 2009-08-19 07:45:17 PDT
> Yeah, I can hear the shoot sound when using the direct link
Does the sound play when you load the file directly in Safari? How about in the current WebKit nightly?

If not, what version of QuickTime do you have installed?
Comment 4 Lyon Chen 2009-08-19 08:03:31 PDT
Hi, Eric

Yeah I can hear the shooting sound when open the WAV file directly with Safari (and whatever browser I tried), but I can't hear the sound when press "B" key for the page.

I have tried official WebKit nightly build r47288 for Windows and newest Chromium build, both didn't play the sound.