W3C home > Mailing lists > Public > public-media-capture@w3.org > May 2015

Re: About onaddtrack/onremovetrack

From: Jan-Ivar Bruaroey <jib@mozilla.com>
Date: Wed, 20 May 2015 14:19:31 -0400
Message-ID: <555CD033.6030303@mozilla.com>
To: Adam Bergkvist <adam.bergkvist@ericsson.com>, Iņaki Baz Castillo <ibc@aliax.net>
CC: "public-media-capture@w3.org" <public-media-capture@w3.org>
On 5/19/15 1:38 AM, Adam Bergkvist wrote:
> Generally speaking, one reason for not firing events together with
> synchronous operations is that by the time the scheduler picks up the
> task that fires the event, the state may have changed synchronously
> again.

I'm not following. Events are synchronous, so when they happen in a 
synchronous call, should it not happen before the call returns?

That's how onclick and onfocus work: http://jsfiddle.net/zh3g52ua

>   The result is that the event doesn't reflect the correct state
> when fired. For example, an addtrack event fires with track as it's
> payload, but the track is no longer present on the MediaStream. That's
> why state updates are made synchronously by the task that fires them; so
> the event properly reflects the state it's supposed to when fired.
>
> /Adam

.: Jan-Ivar :.
Received on Wednesday, 20 May 2015 18:20:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:26:33 UTC