Adam Malcontenti-Wilson
unread,Apr 21, 2012, 9:29:03 AM4/21/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chromium HTML5
Hi,
I've recently found that if you try to use the
responseType="arraybuffer" property that the response property doesn't
get populated until the actual file has finished loading, which poses
a problem when I want to try and read data from a streaming binary
source (e.g. such as a Shoutcast stream (although they may be other
similar use-cases)).
Progress events show me how much data has been downloaded but doesn't
actually allow me to access any of it (that I can see). If I don't
specify a responseType, I can use the responseText property which
shows what it has read thus far, but this is almost useless for binary
data.
Is this a bug (e.g. simply not yet implemented in any major browser),
or a lacking part of the specification? I notice that in the XHR spec,
it defines the "response entity body" as "the fragment of the entity
body of the response received so far" which means that I would have
expected it to work as I've described, but it seems not to. Have I
misinterpreted the spec in this way?
P.S. Ideally for this use-case as it is infinite streaming, XHR might
need to be extended to allow progress events to only contain the last
chunk, and discard the rest of the data instead of buffering it in
memory waiting for the end of the response to fire the load event,
however this might not be the case with other examples such as
attempting to unzip a zip file while it is still being downloaded, and
although it might be a good suggestion for future XHR work, not the
question I am asking at the moment. Also, I understand that I could
use a proxy to decode and chunk over WebSockets, but I'm asking more
about being able to do this in-browser with HTML5 rather than using
intermediate servers.
Thanks,
Adam.