RE: PROPOSAL: Use events instead of callbacks

>-----Original Message-----
>From: Anant Narayanan [mailto:anant@mozilla.com]
>
>As Adam correctly points out subsequently in the thread, chaining and
>bubbling don't really make sense for getUserMedia. However, they do make
>sense for a MediaStream (which could be attached to a <video> or
><canvas>, and may want to bubble events back into the parent). Thus, if
>we add events to MediaStream, I think there's a good case for having
>them be real events. At that point, it's only a matter of consistency
>for having getUserMedia behave in a similar manner.

You don't attach a MediaStream to a <video> or <canvas>. (Yes, I know Rich 
proposed the direct-assign technique, but I'm not in favor of that approach
for a number of reasons.) Instead, you convert the MediaStream into a persistent 
in-memory URL via URL.createObjectURL. The result is a string. So, I'm really 
not sure I get the "bubble events back into the parent" concept. If there were 
to be such a thing, the event handlers would need to be defined on the 
<video>/<img> tags themselves--having them on the MediaStream wouldn't do any 
good.

>
>Thanks,
>-Anant
>

Received on Tuesday, 13 March 2012 18:45:33 UTC