Bug 28439

Summary: Audio object created by JavaScript codes doesn't play.
Product: WebKit Reporter: Lyon Chen <lyon.chen>
Component: Plug-insAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: ap, eric.carlson
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
URL: ttp://www.benjoffe.com/code/demos/canvascape/

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.
Comment 5 Alexey Proskuryakov 2022-07-01 11:35:48 PDT
Mass closing plug-in bugs, as plug-in support has been removed from WebKit.

Please comment and/or reopen if this still affects WebKit in some way.