Re: StreamBuilder threshold

2012-03-27 Thread Robert O'Callahan
On Thu, Feb 23, 2012 at 12:58 PM, Feras Moussa  wrote:

> This isn't clear from the spec (And I've made a note to clarify it) but
> URLs for
>  streams should be one time use URLs (once used it should be automatically
> revoked).


Is it always possible to define that in a sane way?

For example, what if you write
  var url = createObjectURL(stream);
  element.innerHTML = "";
or
  var url = createObjectURL(stream);
  document.getElementsByTagName("style")[0].textContent =
"body, div { background:url(" + url + "); }";

Basically I don't think "the exact moment a URL is used" is a well-defined
concept in our current specs.

Rob
-- 
“You have heard that it was said, ‘Love your neighbor and hate your enemy.’
But I tell you, love your enemies and pray for those who persecute you,
that you may be children of your Father in heaven. ... If you love those
who love you, what reward will you get? Are not even the tax collectors
doing that? And if you greet only your own people, what are you doing more
than others?" [Matthew 5:43-47]


Re: StreamBuilder threshold

2012-02-23 Thread Stefan Hakansson LK

On 02/23/2012 12:58 AM, Feras Moussa wrote:

-Original Message-
From: Stefan Hakansson LK [mailto:stefan.lk.hakans...@ericsson.com]
Sent: Sunday, February 05, 2012 4:50 AM
To: Feras Moussa
Cc: Travis Leithead; public-webapps@w3.org
Subject: Re: StreamBuilder threshold

On 01/26/2012 07:05 PM, Feras Moussa wrote:

Can you please clarify what scenario you are looking at regarding
multiple consumers? When designing the StreamBuilder API, we looked at
it as a more primitive API which other abstractions (such as multiple
consumers) can be built upon.


(Please forgive me if I am making stupid input - I am in a learning phase). A
very simple scenario would be the example in the draft that "demonstrates
how to use StreamBuilder to load a stream into the audio tag". In this
example the consumer is an audio tag, and new data is appended to the
stream each time the buffer falls below 1024 bytes. Fine so far, but what
happens if the same stream (via createObjectURL) is connected to one more
audio tag, but at T ms later.

In this case the first audio tag would have consumed down to the threshold
(1024 bytes) T ms before the second.


This isn't clear from the spec (And I've made a note to clarify it) but URLs for
  streams should be one time use URLs (once used it should be automatically
revoked). Thus a scenario as you said below (connecting the same stream to
multiple tags) isn't possible. There will only be one event to notify the 
threshold
has been reached, thus there should not be multiple consumers 'racing' for this
event.


Would be great to clarify. But to my understanding you could always call 
"createObjectURL" again with the same Stream as input argument. Even if 
both "createObjectURL"'s generate one-time URLs, you could have a 'race' 
condition.





Another example could be that one Stream is uploaded using two parallel
xhr's; one of them could have a couple of pakcet losses and then consume
slower than the other (and if WS could take send(stream) the same would
apply).


If you can please let me know what issue you're trying to address, I'm
happy to discuss the possibilities.


I hope the above input explained the issue.


However, I'm still not clear on what the scenario you'd like to accomplish is - 
can
you please explain it in more detail? If you're looking for a way to reuse data
from a Stream, then you should use StreamReader to read the data as a Blob
(or another type) which will then provide you with all the Blob semantics,
including multiple reads on the data.


Actually I am not trying to satisfy a specific scenario, but I've heard 
people thinking about sending a Stream (being generated at this device 
using StreamBuilder) to several remote ends. I think this would not 
really work since there would always be some differences in transmission 
speed and then the low buffer threshold would have several different 
triggers (as discussed above).


I think it need to be clarified that you can't do this (or attach it to 
several tags), but it is not clear how to clarify it to me (as said 
above, even if you have one time URLs you can create several of them).


Thanks,
Stefan



Thanks,
Feras




Also, For future reference, the latest draft is now located on the W3
site at http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm


Thanks for updating me!

Stefan



Thanks, Feras


-Original Message- From: Stefan Hakansson LK
[mailto:stefan.lk.hakans...@ericsson.com] Sent: Tuesday, January 17,
2012 12:28 AM To: Feras Moussa; Travis Leithead Cc:
public-webapps@w3.org Subject: StreamBuilder threshold

I'm looking at
http://html5labs.interoperabilitybridges.com/streamsapi/, and
specifically at the StreamBuilder.

It has the possibility to generate an event if the data available
falls below a threshold. How is this supposed to work if there is
more than one consumer, and those consumers either don't start
consuming at exactly the same time or consume at different rates, of
the Stream?

--Stefan













RE: StreamBuilder threshold

2012-02-22 Thread Feras Moussa
> -Original Message-
> From: Stefan Hakansson LK [mailto:stefan.lk.hakans...@ericsson.com]
> Sent: Sunday, February 05, 2012 4:50 AM
> To: Feras Moussa
> Cc: Travis Leithead; public-webapps@w3.org
> Subject: Re: StreamBuilder threshold
> 
> On 01/26/2012 07:05 PM, Feras Moussa wrote:
> > Can you please clarify what scenario you are looking at regarding
> > multiple consumers? When designing the StreamBuilder API, we looked at
> > it as a more primitive API which other abstractions (such as multiple
> > consumers) can be built upon.
> 
> (Please forgive me if I am making stupid input - I am in a learning phase). A
> very simple scenario would be the example in the draft that "demonstrates
> how to use StreamBuilder to load a stream into the audio tag". In this
> example the consumer is an audio tag, and new data is appended to the
> stream each time the buffer falls below 1024 bytes. Fine so far, but what
> happens if the same stream (via createObjectURL) is connected to one more
> audio tag, but at T ms later.
> 
> In this case the first audio tag would have consumed down to the threshold
> (1024 bytes) T ms before the second.

This isn't clear from the spec (And I've made a note to clarify it) but URLs for
 streams should be one time use URLs (once used it should be automatically 
revoked). Thus a scenario as you said below (connecting the same stream to 
multiple tags) isn't possible. There will only be one event to notify the 
threshold 
has been reached, thus there should not be multiple consumers 'racing' for this 
event.
 
> Another example could be that one Stream is uploaded using two parallel
> xhr's; one of them could have a couple of pakcet losses and then consume
> slower than the other (and if WS could take send(stream) the same would
> apply).
> >
> > If you can please let me know what issue you're trying to address, I'm
> > happy to discuss the possibilities.
> 
> I hope the above input explained the issue.

However, I'm still not clear on what the scenario you'd like to accomplish is - 
can 
you please explain it in more detail? If you're looking for a way to reuse data 
from a Stream, then you should use StreamReader to read the data as a Blob 
(or another type) which will then provide you with all the Blob semantics, 
including multiple reads on the data.

Thanks,
Feras

 
> >
> > Also, For future reference, the latest draft is now located on the W3
> > site at http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm
> 
> Thanks for updating me!
> 
> Stefan
> 
> >
> > Thanks, Feras
> >
> >> -Original Message- From: Stefan Hakansson LK
> >> [mailto:stefan.lk.hakans...@ericsson.com] Sent: Tuesday, January 17,
> >> 2012 12:28 AM To: Feras Moussa; Travis Leithead Cc:
> >> public-webapps@w3.org Subject: StreamBuilder threshold
> >>
> >> I'm looking at
> >> http://html5labs.interoperabilitybridges.com/streamsapi/, and
> >> specifically at the StreamBuilder.
> >>
> >> It has the possibility to generate an event if the data available
> >> falls below a threshold. How is this supposed to work if there is
> >> more than one consumer, and those consumers either don't start
> >> consuming at exactly the same time or consume at different rates, of
> >> the Stream?
> >>
> >> --Stefan
> >
> >
> 





Re: StreamBuilder threshold

2012-02-05 Thread Stefan Hakansson LK

On 01/26/2012 07:05 PM, Feras Moussa wrote:

Can you please clarify what scenario you are looking at regarding
multiple consumers? When designing the StreamBuilder API, we looked
at it as a more primitive API which other abstractions (such as
multiple consumers) can be built upon.


(Please forgive me if I am making stupid input - I am in a learning 
phase). A very simple scenario would be the example in the draft that 
"demonstrates how to use StreamBuilder to load a stream into the audio 
tag". In this example the consumer is an audio tag, and new data is 
appended to the stream each time the buffer falls below 1024 bytes. Fine 
so far, but what happens if the same stream (via createObjectURL) is 
connected to one more audio tag, but at T ms later.


In this case the first audio tag would have consumed down to the 
threshold (1024 bytes) T ms before the second.


Another example could be that one Stream is uploaded using two parallel 
xhr's; one of them could have a couple of pakcet losses and then consume 
slower than the other (and if WS could take send(stream) the same would 
apply).


If you can please let me know what issue you're trying to address,
I'm happy to discuss the possibilities.


I hope the above input explained the issue.



Also, For future reference, the latest draft is now located on the W3
site at http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm


Thanks for updating me!

Stefan



Thanks, Feras


-Original Message- From: Stefan Hakansson LK
[mailto:stefan.lk.hakans...@ericsson.com] Sent: Tuesday, January
17, 2012 12:28 AM To: Feras Moussa; Travis Leithead Cc:
public-webapps@w3.org Subject: StreamBuilder threshold

I'm looking at
http://html5labs.interoperabilitybridges.com/streamsapi/, and
specifically at the StreamBuilder.

It has the possibility to generate an event if the data available
falls below a threshold. How is this supposed to work if there is
more than one consumer, and those consumers either don't start
consuming at exactly the same time or consume at different rates,
of the Stream?

--Stefan








Re: StreamBuilder threshold

2012-02-05 Thread Anne van Kesteren
On Thu, 26 Jan 2012 19:05:05 +0100, Feras Moussa   
wrote:
When designing the StreamBuilder API, we looked at it as a more  
primitive API which other abstractions (such as multiple consumers) can  
be built upon.


We should not have a StreamBuilder API. We should have a Stream  
constructor, similar to how we should not have a BlobBuilder API, but a  
Blob constructor (and we do now, I believe). It's a lot cleaner and in  
line with best practices for platform API design (which are undocumented,  
unfortunately).



--
Anne van Kesteren
http://annevankesteren.nl/



RE: StreamBuilder threshold

2012-01-26 Thread Feras Moussa
Can you please clarify what scenario you are looking at regarding multiple 
consumers?
When designing the StreamBuilder API, we looked at it as a more primitive API 
which other abstractions (such as multiple consumers) can be built upon. 

If you can please let me know what issue you're trying to address, I'm happy to 
discuss the possibilities.

Also, For future reference, the latest draft is now located on the W3 site at 
http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm

Thanks,
Feras

> -Original Message-
> From: Stefan Hakansson LK [mailto:stefan.lk.hakans...@ericsson.com]
> Sent: Tuesday, January 17, 2012 12:28 AM
> To: Feras Moussa; Travis Leithead
> Cc: public-webapps@w3.org
> Subject: StreamBuilder threshold
> 
> I'm looking at http://html5labs.interoperabilitybridges.com/streamsapi/,
> and specifically at the StreamBuilder.
> 
> It has the possibility to generate an event if the data available falls below 
> a
> threshold. How is this supposed to work if there is more than one consumer,
> and those consumers either don't start consuming at exactly the same time
> or consume at different rates, of the Stream?
> 
> --Stefan