W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2012

Re: [whatwg] Binary Streaming with XHR

From: Jussi Kalliokoski <jussi.kalliokoski@gmail.com>
Date: Fri, 24 Aug 2012 20:32:30 +0300
Message-ID: <CAJhzemXpoFkJStjAC6q+hiXmsH3n2mLRtO8Wc8a2JXV=u5FYqg@mail.gmail.com>
To: olli@pettay.fi
Cc: whatwg@whatwg.org
Is it based on [1]? No wonder I couldn't find precedents in the archives,
when I was looking in the wrong archive! ^^ Thanks.

[1] http://lists.w3.org/Archives/Public/public-webapps/2011JulSep/0741.html

On Fri, Aug 24, 2012 at 6:27 PM, Olli Pettay <Olli.Pettay@helsinki.fi>wrote:

> (This all should go to WebApps WG)
>
> In Gecko there is support for moz-chunked-arraybuffer
> response type.
>
>
>
>
> On 08/24/2012 03:23 AM, Jussi Kalliokoski wrote:
>
>> Hello,
>>
>> I've got a little proposal to solve a problem we're facing with one of our
>> codebases ( aurora.js [1], i.e. audio codecs in JavaScript ).
>>
>> We need to stream the audio files (you don't want to store a 2 hour long
>> live stream in the memory or wait until a whole file is loaded before
>> playing). Currently we're using partial requests to fetch the data, but
>> it's very expensive both in terms of CPU (currently the streaming takes
>> more CPU than the actual decoding, I suspect this is a sum of garbage
>> collection and other factors) and network.
>>
>> My proposal is that we add a feature for streaming to XHRs that are of the
>> arraybuffer response type.
>>
>> My first idea was that if you set a property called "chunkSize" on the
>> XHR,
>> it would start dispatching an event called "onchunk" whenever a chunk of
>> that size has been loaded. That event would contain a property "chunk"
>> that
>> would be an array buffer containing that data. However, I'm having second
>> thoughts on that approach as it is likely to produce a lot of garbage.
>>
>> Instead, my refined idea is that you'd set a "chunk" property on the XHR
>> to
>> an ArrayBuffer, and each time a chunk of the size of the "chunk" was
>> ready,
>> it would set the values of the "chunk" property accordingly and the
>> "onchunk" event would be dispatched.
>>
>> Thoughts?
>>
>> Cheers,
>> Jussi
>>
>> [1] https://github.com/ofmlabs/**aurora.js<https://github.com/ofmlabs/aurora.js>
>>
>>
>
Received on Friday, 24 August 2012 17:33:14 UTC

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