W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2009

[whatwg] autobuffer on "new Audio" objects

From: Robert O'Callahan <robert@ocallahan.org>
Date: Mon, 20 Jul 2009 20:58:10 +1200
Message-ID: <11e306600907200158n57729a9emc72c0d4c00b5e8f0@mail.gmail.com>
On Mon, Jul 20, 2009 at 4:46 PM, David Wilson <dw at botanicus.net> wrote:

> It's easy to see how some naively implemented JS audio widget could
> fetch 200mb over an expensive 3G connection, simply by navigating to
> some site in a background tab (say, by creating an array of elements
> to represent their playlist - something I'd have thought was perfectly
> valid behaviour).
>

In your case even desktop Firefox is smarter than you think. We have a
tunable cache size which we won't download beyond until you free up space by
playing cached data. It's 50MB by default. On mobile we'd obviously reduce
that quite a bit.

I don't think your playlist example is compelling. DOM objects aren't good
for building playlists or other data structures. On the other hand,
var shotSound = new Audio("shot.wav");
...
function shoot() {
  shotSound.play();
  ...
}
should work reliably. For small sounds, leaving out 'autobuffer' may not be
noticed on some browsers, since we have to download metadata and depending
on network conditions we often get the whole file before we start to
throttle the download for non-autobuffer elements.

Rob
-- 
"He was pierced for our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and by his wounds we are
healed. We all, like sheep, have gone astray, each of us has turned to his
own way; and the LORD has laid on him the iniquity of us all." [Isaiah
53:5-6]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090720/cd217ddb/attachment.htm>
Received on Monday, 20 July 2009 01:58:10 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:14 UTC