Re: Streams and Blobs

On Wed, Feb 27, 2013 at 5:26 PM, Glenn Maynard <glenn@zewt.org> wrote:

> I'm simply asking: what use cases there are for creating a stream with XHR
> and handing the stream off to another API, that can't be done much more
> simply by handing a URL to the other API in the first place?
>

I've trimmed off the rest of the discussion since this appears to be the
primary question you want answered. I just wanted to use this email to
capture the use case that I care about most right now.

One of the primary use cases for MSE is adaptive streaming. Early in MSE
spec development I suggested just using URLs as you proposed. When I did
that, it became clear that I needed to address several other requirements
as well.

- Add the ability to specify range requests
- Provide different cross-origin info for each request
- Report status events during the transfer so the application could display
progress and estimate available bandwidth
- Report network error codes
- Abort the transfer early if the application determines that it isn't
worth pulling down the rest of the data.

As I started to address each one of these, I began to realise that I was
just replicating what XHR does already. XHR had everything I needed except
two things.

1. The ability to transfer the data to the MSE objects w/o surfacing the
bytes to JavaScript. (Our friends in the mobile space care about this a
lot.)
2. The ability to consume the bytes as they arrive during the transfer.
(Our friends who want quick startup times and low latency care about this a
lot.)

When I saw the Stream API and the proposal to add it to XHR, I saw a
solution to all the issues I needed to address. It seemed like it would
have very low impact on how XHR would work and it allowed people to
leverage their existing XHR knowledge to formulate the requests they needed.

This is not theorical. Early adopters of MSE are already building adaptive
streaming solutions with standard XHR and really want to see solutions for
items 1 & 2.

I hope this helps you understand a bit where I'm coming from.

Aaron

Received on Thursday, 28 February 2013 17:33:17 UTC