Get the onended event for an AudioBuffer in HTML5/Chrome
Posted
by
Matthew James Davis
on Game Development
See other posts from Game Development
or by Matthew James Davis
Published on 2013-06-27T01:12:54Z
Indexed on
2013/06/27
4:32 UTC
Read the original article
Hit count: 567
So I am playing audio file in Chrome and I want to detect when playing has ended so I can delete references to it. Here is my code
var source = context.createBufferSource();
source.buffer = sound.buffer;
source.loop = sound.loop;
source.onended = function() {
delete playingSounds[soundName];
}
source.connect(mainNode);
source.start(0, sound.start, sound.length);
however, the event handler doesn't fire. Is this not yet supported as described by the W3 specification? Or am I doing something wrong?
© Game Development or respective owner